Class: Sportsflix::API
- Inherits:
-
Object
- Object
- Sportsflix::API
- Defined in:
- lib/sportsflix.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ API
constructor
A new instance of API.
- #watch ⇒ Object
Constructor Details
#initialize(options) ⇒ API
Returns a new instance of API.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sportsflix.rb', line 10 def initialize() @verbose = [:verbose] @stream_offset = [:offset] @club_name = [:club] @interactive = ['interactive'] @video_player = ['video-player'].to_sym @arenavision_client = Providers::Arenavision::Client.new() @executor = Sportsflix::Utils::Executor.new() @players = { :vlc => Sportsflix::Players::VLC::Client.new() } end |
Instance Method Details
#watch ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/sportsflix.rb', line 24 def watch streams = @arenavision_client.list_streams if @club_name streams = streams.select do |stream| stream[:game].downcase.include?(@club_name.downcase) end end response = ask_choose_stream(streams) stream_uri = @arenavision_client.get_stream_uri(response[:channel_number], response[:event]) unless @players.key?(@video_player) puts "Unable to find client for #{@video_player} player" exit(1) end player = @players[@video_player] player.start({ :proxy => response[:stream][:proxy], :uri => stream_uri }) end |