Class: Cejo::Media::Info
- Inherits:
-
Object
- Object
- Cejo::Media::Info
- Defined in:
- lib/cejo/media/get/info.rb
Overview
Media information
Instance Attribute Summary collapse
-
#codec ⇒ Object
Returns the value of attribute codec.
-
#current ⇒ Object
readonly
Returns the value of attribute current.
-
#parser ⇒ Object
Returns the value of attribute parser.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #audio_command ⇒ Object
- #extension ⇒ Object
-
#initialize(url, codec, current) ⇒ Info
constructor
A new instance of Info.
- #program ⇒ Object
- #shorter_title(title) ⇒ Object
- #title ⇒ Object
- #to_s ⇒ Object
- #video_command ⇒ Object
Constructor Details
#initialize(url, codec, current) ⇒ Info
Returns a new instance of Info.
12 13 14 15 16 17 |
# File 'lib/cejo/media/get/info.rb', line 12 def initialize(url, codec, current) @url = url @codec = codec @current = current @parser = Cejo::Media::Parser.new(current, url) end |
Instance Attribute Details
#codec ⇒ Object
Returns the value of attribute codec.
10 11 12 |
# File 'lib/cejo/media/get/info.rb', line 10 def codec @codec end |
#current ⇒ Object (readonly)
Returns the value of attribute current.
9 10 11 |
# File 'lib/cejo/media/get/info.rb', line 9 def current @current end |
#parser ⇒ Object
Returns the value of attribute parser.
10 11 12 |
# File 'lib/cejo/media/get/info.rb', line 10 def parser @parser end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/cejo/media/get/info.rb', line 9 def url @url end |
Instance Method Details
#audio_command ⇒ Object
27 28 29 |
# File 'lib/cejo/media/get/info.rb', line 27 def audio_command "#{program} -o '#{title}.#{current.ext}' #{current.audio} #{codec} #{url}" end |
#extension ⇒ Object
43 44 45 46 |
# File 'lib/cejo/media/get/info.rb', line 43 def extension parser.fmt = :ext parser.result end |
#program ⇒ Object
19 20 21 |
# File 'lib/cejo/media/get/info.rb', line 19 def program current.name end |
#shorter_title(title) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/cejo/media/get/info.rb', line 36 def shorter_title(title) max_words = 6 fixed = title.split[0...max_words].join(' ') title.split.size > max_words ? fixed : title end |
#title ⇒ Object
31 32 33 34 |
# File 'lib/cejo/media/get/info.rb', line 31 def title parser.fmt = :title shorter_title parser.result end |
#to_s ⇒ Object
48 49 50 |
# File 'lib/cejo/media/get/info.rb', line 48 def to_s "#{title}.#{extension}" end |
#video_command ⇒ Object
23 24 25 |
# File 'lib/cejo/media/get/info.rb', line 23 def video_command "#{program} -o '#{title}.#{current.ext}' #{current.video} #{codec} #{url}" end |