Sha256: 6357fa37c7f354f0b5350973634e24a8b19d94e9e8ebf31b6ae42a2875c652c8

Contents?: true

Size: 682 Bytes

Versions: 15

Compression:

Stored size: 682 Bytes

Contents

#
# Implementes MetaInfo Interface for MPlayer
#

# MetaInformation = Struct.new(:duration, :bit_rate, :size, :format, :extension, :raw)

require_relative '../time_index'

module VCSRuby
  class MPlayerMetaInfo
    attr_reader :raw

    def initialize meta_info, filesize
      @raw = meta_info
      @filesize = filesize
    end

    def duration
      TimeIndex.new(@raw['ID_LENGTH'].to_f)
    end

    def bit_rate
      @raw['ID_AUDIO_BITRATE'].to_i + @raw['ID_VIDEO_BITRATE'].to_i
    end

    def size
      @filesize
    end

    def format
      extension
    end

    def extension
      ext = File.extname(@raw['ID_FILENAME'])
      ext[0] = ''
      ext
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vcs_ruby-1.1.16 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.15 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.14 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.13 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.12 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.11 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.10 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.8 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.7 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.6 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.5 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.4 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.3 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.2 lib/MPlayer/mplayer_meta_info.rb
vcs_ruby-1.1.0 lib/MPlayer/mplayer_meta_info.rb