Class: SVT::Recorder::Play

Inherits:
Base
  • Object
show all
Defined in:
lib/svt/recorder/play.rb

Overview

Recorder for SVT Play. Takes the URL for a video on SVT Play and returns the URLs for all parts.

Usage:

recorder = SVT::Recorder::Play.new(url)
recorder.title # => The title of the video from SVT Play
# If you want to decide which bitrate you want to record check which
# are available, otherwise the highest bitrate will be choosen.
recorder.bitrates # => [696752, ... more bitrates ...]
recorder.part_urls(696752) # => [base_url, [part_names], bitrate]

Or for the quick fix:

SVT::Recorder::Play.record(url) # => [base_url, [part_names], bitrate, video_title]

Instance Attribute Summary

Attributes inherited from Base

#base_url, #bitrate, #title

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#all_parts, #bitrates, #get_streams, #part_urls, #parts, #parts?

Constructor Details

#initialize(url) ⇒ Play

Returns a new instance of Play.



29
30
31
32
33
34
35
# File 'lib/svt/recorder/play.rb', line 29

def initialize(url)
  video = SVT::Recorder.fetch_playlist(url, '#player') do |url|
    "#{File.join('http://www.svtplay.se', url)}?output=json"
  end

  super(video)
end

Class Method Details

.record(url) ⇒ Object

Instantiate the class with url and get all part URL:s for the highest bitrate available.



39
40
41
42
# File 'lib/svt/recorder/play.rb', line 39

def self.record(url)
  recorder = SVT::Recorder::Play.new(url)
  recorder.part_urls
end