From 90401b3819d01c903a72d244f125b518429c014c Mon Sep 17 00:00:00 2001 From: lulzette Date: Wed, 21 Apr 2021 18:43:30 +0000 Subject: [PATCH] fixes,fixes,fixes... --- .gitignore | 3 ++- check.sh | 9 +++++---- cron.sh | 4 ++-- lifeChk.py | 2 +- requirements.txt | 2 ++ 5 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 requirements.txt diff --git a/.gitignore b/.gitignore index 6b55ed5..67b05d3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ list.sh config_python.py -config_list.sh \ No newline at end of file +config_list.sh +__pycache__ \ No newline at end of file diff --git a/check.sh b/check.sh index cd3f433..d747cd5 100755 --- a/check.sh +++ b/check.sh @@ -5,20 +5,21 @@ full_path=$(dirname "$(realpath $0)") -source $full_path/list.sh +source $full_path/config_list.sh #check if not running, kill if running and stream is finished (broken record) -[ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 && exit 0 || kill -9 $(cat $storage_path/$1/pid) +# [ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 && exit 0 || kill -9 $(cat $storage_path/$1/pid) +[ -f $storage_path/$1/pid ] && $full_path/lifeChk.py $1 && exit 0 #exit if no stream $full_path/lifeChk.py $1 || exit 0 - +echo `$full_path/lifeChk.py $1` #set pid and start downloading -nohup $ytdl_path/youtube-dl -v -o $storage_path/$1/"%(upload_date)s_%(title)s__%(timestamp)s_%(id)s.%(ext)s" twitch.tv/$1 >> $storage_path/$1/youtube-dl.log 2>&1 & echo $! > $storage_path/$1/pid +nohup /home/losted/.local/bin/youtube-dl -v -o $storage_path/$1/"%(upload_date)s_%(title)s__%(timestamp)s_%(id)s.%(ext)s" twitch.tv/$1 >> $storage_path/$1/youtube-dl.log 2>&1 & echo $! > $storage_path/$1/pid #remove pid diff --git a/cron.sh b/cron.sh index 6743600..37cd7fd 100755 --- a/cron.sh +++ b/cron.sh @@ -12,7 +12,7 @@ for i in $list; do [ ! -d $storage_path/$i ] && mkdir -p $storage_path/$i && echo "Created dir $storage_path/$i" #detached check & start - screen -dmS $i bash $full_path/check.sh $i + bash $full_path/check.sh $i sleep 2 done @@ -21,6 +21,6 @@ done echo "====" for i in $list; do - [ -f $storage_path/$i/pid] && echo $i "is recording!" || echo $i "is not recording" + [[ -f $storage_path/$i/pid ]] && echo $i "is recording!" || echo $i "is not recording" done echo "====" diff --git a/lifeChk.py b/lifeChk.py index cc78314..525a8cf 100755 --- a/lifeChk.py +++ b/lifeChk.py @@ -9,7 +9,7 @@ import config_python from twitch import TwitchClient -client = TwitchClient(client_id=twitchid) #client init +client = TwitchClient(client_id=config_python.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) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..a757172 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +youtube-dl==2021.4.17 +python-twitch-client==0.7.1 \ No newline at end of file