added check for rerun (lifeChk.py)
This commit is contained in:
parent
53cbd997d0
commit
c49ba072c1
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"python.pythonPath": "/bin/python"
|
||||
}
|
8
lifeChk.py
Executable file → Normal file
8
lifeChk.py
Executable file → Normal file
@ -6,14 +6,16 @@ import sys
|
||||
#if not sys.argv[1]:
|
||||
# sys.exit(2)
|
||||
|
||||
twitchid = "59hrsplx7dmvc17pqkqcm9l3n1uzc4"
|
||||
from twitch import TwitchClient
|
||||
twitchid = "59hrsplx7dmvc17pqkqcm9l3n1uzc4"
|
||||
client = TwitchClient(client_id=twitchid) #client init
|
||||
user_id=client.users.translate_usernames_to_ids(sys.argv[1])[0].id #get id
|
||||
#get live by id (if var not empty)
|
||||
|
||||
if client.streams.get_stream_by_user(user_id):
|
||||
print(user_id)
|
||||
print(client.streams.get_stream_by_user(user_id).stream_type)
|
||||
if client.streams.get_stream_by_user(user_id).stream_type == 'live':
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user