-
-
Save brettpetch/2f3147eaff75294003261df9dfd0208a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
autobrr_config=$HOME/.config/autobrr/autobrr.db | |
declare -a filters=(race-TV race-TV4K race-TVDV race-Movies race-Movies4K race-MoviesDV race-BluRay race-BluRay4K race-BluRayDV) | |
bu_keep_days=3 #number of days to keep | |
db_path=$HOME/.config/autobrr/ | |
# Install dependency for scripts | |
type curl &>/dev/null || { | |
sudo apt-get update > /dev/null 2>&1 | |
sudo apt-get install -y curl > /dev/null 2>&1 | |
} | |
type sqlite3 &>/dev/null || { | |
sudo apt-get update > /dev/null 2>&1 | |
sudo apt-get install -y sqlite3 > /dev/null 2>&1 | |
} | |
# Grab upcoming blurays | |
bluray=$( | |
curl -sL "https://sudoer.dev/bluray" || { | |
echo "Failed to run BluRay injection." | |
exit 1 | |
} | |
) | |
# Grab upcoming movies | |
movies=$( | |
curl -sL "https://sudoer.dev/movies" || { | |
echo "Failed to run Streaming Movies injection." | |
exit 2 | |
} | |
) | |
shows=$( | |
curl -sL "https://sudoer.dev/tv" || { | |
echo "Failed to run TV injection." | |
exit 3 | |
} | |
) | |
# Grab 7 days worth of upcoming TV shows. If they have reach 50% rating on trakt it moves there. | |
shows_anticipated=$( | |
curl -sL "https://sudoer.dev/anticipated" || { | |
echo "Failed to run Anticipated injection." | |
exit 4 | |
} | |
) | |
sqlite3 ${autobrr_config} ".backup ${autobrr_config}.$(date +"%Y_%m_%d_%I_%M_%p").bak" || { | |
echo "failed to backup db" | |
exit 6 | |
} | |
mov='.*mov*' | |
blu='.*blu*' | |
tv='.*tv*' | |
tvant='.*ant*' | |
group='.*group*' | |
#4k='.*4k*' | |
#dv='.*dv*' | |
for i in ${filters[@]}; do | |
if [[ ${i,,} =~ ${tvant} ]]; then | |
sqlite3 ${autobrr_config} <<EOS | |
update filter set match_releases = "${shows_anticipated}" where name = "${i}"; | |
EOS | |
elif [[ ${i,,} =~ ${blu} ]]; then | |
sqlite3 ${autobrr_config} <<EOS | |
update filter set match_releases = "${bluray}" where name = "${i}"; | |
EOS | |
elif [[ ${i,,} =~ ${mov} ]]; then | |
sqlite3 ${autobrr_config} <<EOB | |
update filter set match_releases = "${movies}" where name = "${i}"; | |
EOB | |
elif [[ ${i,,} =~ ${group} ]]; then | |
sqlite3 ${autobrr_config} <<EOC | |
update filter set match_release_groups = "${release_groups}" where name = "${i}"; | |
EOC | |
elif [[ ${i,,} =~ ${tv} ]]; then | |
sqlite3 ${autobrr_config} <<EOD | |
update filter set match_releases = "${shows}" where name = "${i}"; | |
EOD | |
else | |
echo "${i} did not match either movie or tv." | |
fi | |
done | |
find $db_path -name "autobrr.db.20??_??_??_??_??_??.bak" -mtime +$bu_keep_days -type f -delete |
Hello
Do you got an api version of this?
Cheers
Not atm. Might look at it later. Been busy. Sent from my iPhoBNOn Sep 16, 2022, at 3:03 AM, Yankees4life ***@***.***> ***@***.*** commented on this gist.
Hello
Do you got an api version of this?
Cheers
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
This link is not working: https://gl0ry.us/groups
How can that link be replaced?
Hi,
no plans on replacement atm.
Hi,
no plans on replacement atm.
Can you give me a clue of what was on that file, So I could recreate it.
Hi,
no plans on replacement atm.Can you give me a clue of what was on that file, So I could recreate it.
It was a comma separated list of release groups.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regbrr
This is a script that will take input for filters, then match them against a set of pre-defined strings to match against. If it finds a match in the filter name, it will update the respective filter. This was rewritten this way because some users have 4K/4K DV filters and want them to match without introducing additional variables. By using a bash array, as declared on line 3, we are able to specify a number of filters and loop through them.
Setting up this script is as simple as
race-TV race-TV4K race-TVDV race-Movies race-Movies4K race-MoviesDV race-BluRay race-BluRay4K race-BluRayDV
).Note that this script will backup the database prior to running. To clear out the db backups, you can do
rm -f ~/.config/autobrr/*.bak*
There are no warranties or guarantees when running this script. It is your responsibility to ensure that all domains resolve correctly and that your db doesn't get f*cked up.
Do not contact me for support. This is not officially supported by the app dev in any kind of capacity. You should understand how this works if you so choose to use it.