Class: RakeMKV::Disc
- Inherits:
-
Object
- Object
- RakeMKV::Disc
- Defined in:
- lib/rakemkv/disc.rb
Overview
Disc object
Constant Summary collapse
- DEFAULT_MINLENGTH =
120
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #destination_with_name ⇒ Object
- #filesafe_name ⇒ Object
-
#info ⇒ Object
parse file info from command.
-
#initialize(location:, destination: Dir.pwd, minlength: DEFAULT_MINLENGTH, parser_class: RakeMKV::Parser) ⇒ Disc
constructor
Initialize disc.
-
#method_missing(method, *args) ⇒ Object
Meta disc information.
-
#path ⇒ Object
Get path from location.
-
#titles ⇒ Object
Get titles for disc.
-
#transcode!(title_id: titles.longest.id) ⇒ Object
Transcode information on disc.
Constructor Details
#initialize(location:, destination: Dir.pwd, minlength: DEFAULT_MINLENGTH, parser_class: RakeMKV::Parser) ⇒ Disc
Initialize disc
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rakemkv/disc.rb', line 8 def initialize( location:, destination: Dir.pwd, minlength: DEFAULT_MINLENGTH, parser_class: RakeMKV::Parser ) @location = location @destination = destination @minlength = minlength @parser_class = parser_class end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
Meta disc information
56 57 58 |
# File 'lib/rakemkv/disc.rb', line 56 def method_missing(method, *args) info.cinfo[method.to_sym] || super end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/rakemkv/disc.rb', line 3 def location @location end |
Instance Method Details
#destination_with_name ⇒ Object
60 61 62 |
# File 'lib/rakemkv/disc.rb', line 60 def destination_with_name File.join(destination, filesafe_name) end |
#filesafe_name ⇒ Object
46 47 48 |
# File 'lib/rakemkv/disc.rb', line 46 def filesafe_name info.cinfo[:name].downcase.gsub(/[\/ ]/ , "_") end |
#info ⇒ Object
parse file info from command
36 37 38 |
# File 'lib/rakemkv/disc.rb', line 36 def info @info ||= parser_class.new command.info(arguments) end |
#path ⇒ Object
Get path from location
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rakemkv/disc.rb', line 21 def path if location =~ /^\/dev/ "dev:#{location}" elsif location =~ /iso$/ "iso:#{location}" elsif location.is_a?(Integer) "disc:#{location}" elsif location =~ /^disc/ location else raise RuntimeError end end |
#titles ⇒ Object
Get titles for disc
51 52 53 |
# File 'lib/rakemkv/disc.rb', line 51 def titles RakeMKV::Titles.new(build_titles) end |
#transcode!(title_id: titles.longest.id) ⇒ Object
Transcode information on disc
41 42 43 44 |
# File 'lib/rakemkv/disc.rb', line 41 def transcode!(title_id: titles.longest.id) check_and_create_destination command.mkv(title_id, destination_with_name, arguments) end |