Class: Mkv2m4v::File

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mkv2m4v/file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename, options = {}) ⇒ File

Returns a new instance of File.



19
20
21
22
23
24
# File 'lib/mkv2m4v/file.rb', line 19

def initialize(filename, options = {})
  @info = Mediainfo.new(filename)
  @options = options
  @languages = @options[:languages]
  init_tracks
end

Instance Attribute Details

#audio_tracksObject (readonly)

Returns the value of attribute audio_tracks.



13
14
15
# File 'lib/mkv2m4v/file.rb', line 13

def audio_tracks
  @audio_tracks
end

#filtered_audio_tracksObject (readonly)

Returns the value of attribute filtered_audio_tracks.



14
15
16
# File 'lib/mkv2m4v/file.rb', line 14

def filtered_audio_tracks
  @filtered_audio_tracks
end

#filtered_text_tracksObject (readonly)

Returns the value of attribute filtered_text_tracks.



14
15
16
# File 'lib/mkv2m4v/file.rb', line 14

def filtered_text_tracks
  @filtered_text_tracks
end

#filtered_video_tracksObject (readonly)

Returns the value of attribute filtered_video_tracks.



14
15
16
# File 'lib/mkv2m4v/file.rb', line 14

def filtered_video_tracks
  @filtered_video_tracks
end

#ideal_audio_trackObject (readonly)

Returns the value of attribute ideal_audio_track.



15
16
17
# File 'lib/mkv2m4v/file.rb', line 15

def ideal_audio_track
  @ideal_audio_track
end

#ideal_text_trackObject (readonly)

Returns the value of attribute ideal_text_track.



15
16
17
# File 'lib/mkv2m4v/file.rb', line 15

def ideal_text_track
  @ideal_text_track
end

#ideal_video_trackObject (readonly)

Returns the value of attribute ideal_video_track.



15
16
17
# File 'lib/mkv2m4v/file.rb', line 15

def ideal_video_track
  @ideal_video_track
end

#infoObject (readonly)

Returns the value of attribute info.



13
14
15
# File 'lib/mkv2m4v/file.rb', line 13

def info
  @info
end

#text_tracksObject (readonly)

Returns the value of attribute text_tracks.



13
14
15
# File 'lib/mkv2m4v/file.rb', line 13

def text_tracks
  @text_tracks
end

#video_tracksObject (readonly)

Returns the value of attribute video_tracks.



13
14
15
# File 'lib/mkv2m4v/file.rb', line 13

def video_tracks
  @video_tracks
end

Class Method Details

.each(filenames, options = {}) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/mkv2m4v/file.rb', line 43

def self.each(filenames, options = {})
  filenames.each do |filename|
    if ::File.exists?(filename)
      yield new(filename, options)
    else
      $stderr.puts "#{filename} does not exist."
    end
  end
end

Instance Method Details

#formatObject



26
27
28
# File 'lib/mkv2m4v/file.rb', line 26

def format
  info.general.format
end


30
31
32
33
34
# File 'lib/mkv2m4v/file.rb', line 30

def print_info
  process do
    print_filtered_tracks
  end
end

#transcodeObject



36
37
38
39
40
41
# File 'lib/mkv2m4v/file.rb', line 36

def transcode
  process do
    print_ideal_tracks
    Transcoder.new(self, @options).run
  end
end