Module: Livestreamer
- Defined in:
- lib/twitchy/livestreamer.rb
Constant Summary collapse
- @@sort =
["best","source","high","medium","low","mobile","worst"]
Class Method Summary collapse
- .get_available_streams(channel) ⇒ Object
- .start_stream(channel, player, quality, chat) ⇒ Object
- .start_video(url, player) ⇒ Object
Class Method Details
.get_available_streams(channel) ⇒ Object
7 8 9 |
# File 'lib/twitchy/livestreamer.rb', line 7 def self.get_available_streams(channel) @@sort & JSON.parse(`livestreamer -j twitch.tv/#{channel}`)["streams"].keys end |
.start_stream(channel, player, quality, chat) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/twitchy/livestreamer.rb', line 11 def self.start_stream(channel, player, quality, chat) stream = "livestreamer -Q -p '#{player}' "\ "twitch.tv/#{channel} #{quality} & " popout_chat = "http://www.twitch.tv/chat/embed"\ "?channel=#{channel}&popout_chat=true" Launchy.open(popout_chat) if chat exec stream end |
.start_video(url, player) ⇒ Object
20 21 22 23 |
# File 'lib/twitchy/livestreamer.rb', line 20 def self.start_video(url, player) exec "livestreamer -Q -p '#{player}' "\ "#{url} best &" end |