Created
July 26, 2015 10:55
-
-
Save jschmid1/88db7657836c84d481d0 to your computer and use it in GitHub Desktop.
tw stream selector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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&") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍