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"
|
||||||
|
}
|
12
lifeChk.py
Executable file → Normal file
12
lifeChk.py
Executable file → Normal file
@ -4,16 +4,18 @@
|
|||||||
#################
|
#################
|
||||||
import sys
|
import sys
|
||||||
#if not sys.argv[1]:
|
#if not sys.argv[1]:
|
||||||
# sys.exit(2)
|
# sys.exit(2)
|
||||||
|
|
||||||
twitchid = "59hrsplx7dmvc17pqkqcm9l3n1uzc4"
|
|
||||||
from twitch import TwitchClient
|
from twitch import TwitchClient
|
||||||
|
twitchid = "59hrsplx7dmvc17pqkqcm9l3n1uzc4"
|
||||||
client = TwitchClient(client_id=twitchid) #client init
|
client = TwitchClient(client_id=twitchid) #client init
|
||||||
user_id=client.users.translate_usernames_to_ids(sys.argv[1])[0].id #get id
|
user_id=client.users.translate_usernames_to_ids(sys.argv[1])[0].id #get id
|
||||||
#get live by id (if var not empty)
|
#get live by id (if var not empty)
|
||||||
|
|
||||||
if client.streams.get_stream_by_user(user_id):
|
if client.streams.get_stream_by_user(user_id):
|
||||||
sys.exit(0)
|
print(user_id)
|
||||||
else:
|
print(client.streams.get_stream_by_user(user_id).stream_type)
|
||||||
sys.exit(1)
|
if client.streams.get_stream_by_user(user_id).stream_type == 'live':
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
|
sys.exit(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user