Skip to content

Instantly share code, notes, and snippets.

@jschmid1
Created July 26, 2015 10:55
Show Gist options
  • Select an option

  • Save jschmid1/88db7657836c84d481d0 to your computer and use it in GitHub Desktop.

Select an option

Save jschmid1/88db7657836c84d481d0 to your computer and use it in GitHub Desktop.
tw stream selector
#!/usr/bin/ruby
require 'kappa'
games = []
Twitch.games.top(:limit => 10) {|game| games.push(game.name)}
games_hash = Hash[(1...games.size).zip games]
games_hash.each do |k,v|
puts "#{k}: #{v}"
end
print "Pick a Game :"
input = STDIN.gets.chomp
streams = []
Twitch.streams.find(:game => games_hash[input.to_i], :limit => 10) do |stream|
streams.push(stream.channel.display_name)
end
streams_hash = Hash[(1...streams.size).zip streams]
streams_hash.each do |k,v|
puts "#{k}: #{v}"
end
print "Pick a Stream: "
input = STDIN.gets.chomp
system("/usr/bin/livestreamer #{Twitch.streams.get(streams_hash[input.to_i]).channel.url} best&")
@thutterer

Copy link
Copy Markdown

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment