diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b26f7c4 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/bin/python" +} \ No newline at end of file diff --git a/lifeChk.py b/lifeChk.py old mode 100755 new mode 100644 index 58f4c01..baaf437 --- a/lifeChk.py +++ b/lifeChk.py @@ -4,16 +4,18 @@ ################# import sys #if not sys.argv[1]: -# sys.exit(2) +# 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): - sys.exit(0) -else: - sys.exit(1) + 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) +sys.exit(1) diff --git a/main.py b/main.py new file mode 100644 index 0000000..d8dbf66 --- /dev/null +++ b/main.py @@ -0,0 +1 @@ +#!/bin/python3 diff --git a/cron.sh b/main.sh similarity index 100% rename from cron.sh rename to main.sh