Class: IPlayer::Metadata
- Inherits:
-
Object
- Object
- IPlayer::Metadata
- Includes:
- Errors
- Defined in:
- lib/iplayer/metadata.rb
Constant Summary collapse
- METADATA_URL =
'http://www.bbc.co.uk/iplayer/playlist/%s'
Instance Method Summary collapse
- #filetype ⇒ Object
- #full_title ⇒ Object
-
#initialize(pid, browser) ⇒ Metadata
constructor
A new instance of Metadata.
- #title ⇒ Object
- #versions ⇒ Object
Constructor Details
#initialize(pid, browser) ⇒ Metadata
Returns a new instance of Metadata.
11 12 13 14 |
# File 'lib/iplayer/metadata.rb', line 11 def initialize(pid, browser) @pid = pid @browser = browser end |
Instance Method Details
#filetype ⇒ Object
24 25 26 |
# File 'lib/iplayer/metadata.rb', line 24 def filetype radio? ? AUDIO_FILETYPE : VIDEO_FILETYPE end |
#full_title ⇒ Object
20 21 22 |
# File 'lib/iplayer/metadata.rb', line 20 def full_title dmy_to_ymd(mixed_title).gsub(/\s*:\s*/, ' - ') end |
#title ⇒ Object
16 17 18 |
# File 'lib/iplayer/metadata.rb', line 16 def title mixed_title.split(/:/).first end |
#versions ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/iplayer/metadata.rb', line 28 def versions versions = {} REXML::XPath.each(, '//playlist/item') do |node| version_pid = node.attributes['identifier'] or next alternate_id = REXML::XPath.first(node, 'alternate').attributes['id'] rescue 'anonymous' versions[alternate_id] = version_pid end versions end |