Twitch Online Stream return


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Twitch Online Stream return
# 1  
Old 03-28-2015
Twitch Online Stream return

Hello all! A buddy and I just created a script to bring up a live streamer of twitch on vlc through a terminal command, and it works great as long as the stream is live. Otherwise it tells us it can't find the stream. Now we want to make a terminal command to tell us which of our followed users in our twitch account are online and streaming. Something like went enter a command in the terminal and the code prints out the streamers names so we know which we can type in to get the live streamer to work. However we are kind of stuck and don't really know what to do. Would anyone be able to help or give suggestions? Thank you!
# 2  
Old 03-28-2015
Code

Here's what we have:
In bash:
Code:
#!/bin/bash
if [ "$2" == "-nochat" ]
then
    livestreamer twitch.tv/$1 best --player vlc
else
    livestreamer twitch.tv/$1 best --player vlc & java -jar ~/.chatty_app/Chatty.jar
fi
exit

In Python:
Code:
import requests

array = []
with open("~/.list.txt", "r") as ins:
    for user in ins:
        user = user.strip();
        url = "https://api.twitch.tv/kraken/streams/" + user
        if requests.get(url).status_code != 200:
            array.append(user + ": offline")
        else:
            array.append(user + ": online")

for x in range(0,len(array)):
    print array[x]

---------- Post updated at 02:24 PM ---------- Previous update was at 02:19 PM ----------

Quote:
Originally Posted by Loofa of Doom
Hello all! A buddy and I just created a script to bring up a live streamer of twitch on vlc through a terminal command, and it works great as long as the stream is live. Otherwise it tells us it can't find the stream. Now we want to make a terminal command to tell us which of our followed users in our twitch account are online and streaming. Something like went enter a command in the terminal and the code prints out the streamers names so we know which we can type in to get the live streamer to work. However we are kind of stuck and don't really know what to do. Would anyone be able to help or give suggestions? Thank you!
API:

https://github.com/justintv/twitch-api
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Video stream] network stream recording with mplayer

Hi I used this command: mplayer http://host/axis-cgi/mjpg/video.cgi -user root -passwd root \ -cache 1024 -fps 25.0 -nosound -vc ffh264 \ -demuxer 3 -dumpstream -dumpfile output.avi It's ok but... Video Playing is very fast! Why? Is it a synch problem? What parameter I have to use for... (1 Reply)
Discussion started by: takeo.kikuta
1 Replies

2. UNIX for Advanced & Expert Users

carriage return stamp online

hi all, someone knows why the carriare return on txseries-aix don't work? exsample: i have: 01 TESTATA-INIZIO. 03 TESTA-NL1 PIC X. 03 R-TESTA1. 05 FILLER PIC X(70) VALUE SPACE. 05 DATA-ST1 PIC... (11 Replies)
Discussion started by: tullo
11 Replies
Login or Register to Ask a Question