Class: SVT::Recorder::Rapport
Overview
Recorder for SVT Play Rapport Takes an URL for playrapport.se and returns the download URL in the same format as SVT Play class.
Usage is the same as for SVT::Recorder::Play, apart from that Play Rapport doesn’t play around with different bitrates.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #bitrates ⇒ Object
-
#initialize(url) ⇒ Rapport
constructor
A new instance of Rapport.
- #part_urls(bitrate = :whatever) ⇒ Object
-
#rapport_xml_url(id = '') ⇒ Object
This is the base URL from where Play Rapport fetches its information As a method to make it easier to replace for testing.
Methods inherited from Base
Constructor Details
#initialize(url) ⇒ Rapport
Returns a new instance of Rapport.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/svt/recorder/rapport.rb', line 18 def initialize(url) @id = url.match(/(\d+)$/)[1] doc = REXML::Document.new(open(rapport_xml_url(@id))) content = doc.elements['//media:content'] url = content.attribute('url').value @title = doc.elements['//title'].text @bitrate = content.attribute('bitrate').value.to_i @parts = [File.basename(url)] @base_url = File.dirname(url) end |
Instance Method Details
#bitrates ⇒ Object
35 |
# File 'lib/svt/recorder/rapport.rb', line 35 def bitrates ; [@bitrate] ; end |
#part_urls(bitrate = :whatever) ⇒ Object
37 38 39 |
# File 'lib/svt/recorder/rapport.rb', line 37 def part_urls(bitrate = :whatever) return self end |
#rapport_xml_url(id = '') ⇒ Object
This is the base URL from where Play Rapport fetches its information As a method to make it easier to replace for testing
31 32 33 |
# File 'lib/svt/recorder/rapport.rb', line 31 def rapport_xml_url(id = '') #:nodoc: "http://xml.svtplay.se/v1/videos/#{id}" end |