Skip to content

Instantly share code, notes, and snippets.

@kantjer01
Created July 29, 2023 13:09
Show Gist options
  • Save kantjer01/f644b1d6f38d3985dd300851e396ddb1 to your computer and use it in GitHub Desktop.
Save kantjer01/f644b1d6f38d3985dd300851e396ddb1 to your computer and use it in GitHub Desktop.
upgraderr-deltags.sh
#!/bin/bash
# This script removes the 'export' tags from the qbit instance on the seedbox, and the 'imported' tags on the qbit instances on the localhost.
# load variables
set -o allexport
source /volume1/scripts/upgraderr/upgraderr.env
set +o allexport
log="$log_dir/deltags.$(date +"%Y-%m-%d_%H.%M").log"
# "Remove 'export' tags on seedbox
echo "Remove 'Imported' tags on seedbox" | tee $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_remote}",
"user":"${user_remote}",
"password":"${password_remote}",
"action":"tagdel",
"subject":"export",
"query":"DisableCrossseed() && Tags contains 'export'"}
CURL_DATA
# "Remove 'imported' tags for movies on localhost
echo "Remove 'imported' tags for movies on localhost" | tee -a $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_movies_local}",
"user":"${user_local}",
"password":"${password_local}",
"action":"tagdel",
"subject":"imported",
"query":"DisableCrossseed() && Tags contains 'imported'"}
CURL_DATA
# Remove 'imported' tags for series on localhost
echo "Remove 'imported' tags for series on localhost" | tee -a $log
curl -X POST -H "Content-Type: application/json" -d @- "$webhook_url" <<CURL_DATA | tee -a $log
{"host":"${host_series_local}",
"user":"${user_local}",
"password":"${password_local}",
"action":"tagdel",
"subject":"imported",
"query":"DisableCrossseed() && Tags contains 'imported'"}
CURL_DATA
# cleanup log files
if ls -t $log_dir/deltags.*.log &>/dev/null; then
ls -t $log_dir/deltags.*.log | tail -n +4 | xargs rm -f --
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment