chg: Improved qbt send script

This commit is contained in:
Sayantan Santra 2023-12-04 19:09:11 -06:00
parent 25e6944fc9
commit 8dab2cac01
Signed by: SinTan1729
GPG Key ID: EB3E68BFBA25C85F
1 changed files with 32 additions and 5 deletions

View File

@ -12,12 +12,39 @@ if [ "$3" == "add" ]; then
elif [ "$3" == "fin" ]; then elif [ "$3" == "fin" ]; then
size="$(echo $2 | numfmt --to=iec --format %.2f)B" size="$(echo $2 | numfmt --to=iec --format %.2f)B"
message="Finished: [$size] $name" message="Finished: [$size] $name"
if [ "$4" == "movie" ]; then
item=${5/\/downloads\//\.\.\/}
if [ -f "$item" ]; then
cp -l "$item" ../Temp/
cd ../Temp/
old=$(ls)
movie-rename -l *
new=$(ls)
folderify.py
[ "$old" != "$new" ] && mv * ../Movies/
fi
if [ -d "$item" ]; then
cp -lr "$item" ../Temp/
cd ../Temp/
cd *
find . -name "*.srt" | tail -n 1 | xargs -I{} mv {} .
rename-subs en
find . -type d -exec rm -rf "{}" \;
find . \! \( -name "*.mp4" -o -name "*.srt" -o -name "*.mkv" \) -exec rm -f "{}" \;
old=$(ls)
movie-rename -ld "$item"
new=$(ls)
[ "$old" != "$new" ] && mv * ../Movies/
fi
fi
else else
exit exit
fi fi
curl -H "Icon: https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/New_qBittorrent_Logo.svg/240px-New_qBittorrent_Logo.svg.png" \ curl -H "Icon: https://upload.wikimedia.org/wikipedia/commons/thumb/6/66/New_qBittorrent_Logo.svg/240px-New_qBittorrent_Logo.svg.png" \
-H "Title: qBittorrent" \ -H "Title: qBittorrent" \
-H "Priority: low" \ -H "Priority: low" \
-d "$message" \ -d "$message" \
https://ntfy.sh/topic-name https://ntfy.sh/topic-name