Create AutoConfig.bash

pull/49/head
RandomNinjaAtk 2 years ago committed by GitHub
parent c9c4b005cc
commit f6fa2e23ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,45 @@
#!/usr/bin/env bash
scriptVersion="1.0.001"
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
if [ "$arrUrlBase" = "null" ]; then
arrlBase=""
else
arrUrlBase="/$(echo "$arrUrlBase" | sed "s/\///g")"
fi
arrApiKey="$(cat /config/config.xml | xq | jq -r .Config.ApiKey)"
arrPort="$(cat /config/config.xml | xq | jq -r .Config.Port)"
arrUrl="http://127.0.0.1:${arrPort}${arrUrlBase}"
fi
# auto-clean up log file to reduce space usage
if [ -f "/config/logs/AutoConfig.txt" ]; then
find /config/logs -type f -name "AutoConfig.txt" -size +1024k -delete
fi
exec &>> "/config/logs/AutoConfig.txt"
chmod 666 "/config/logs/AutoConfig.txt"
log () {
m_time=`date "+%F %T"`
echo $m_time" :: AutoConfig :: "$1
}
log "Getting Trash Guide Recommended Movie Naming..."
movieNaming="$(curl -s https://raw.githubusercontent.com/TRaSH-/Guides/master/docs/Radarr/Radarr-recommended-naming-scheme.md | grep "{Movie Clean" | head -n 1)"
log "Updating Radarr Moving Naming..."
curl "$arrUrl/api/v3/config/naming" -X PUT -H "Content-Type: application/json" -H "X-Api-Key: $arrApiKey" --data-raw "{
\"renameMovies\":true,
\"replaceIllegalCharacters\":true,
\"colonReplacementFormat\":\"delete\",
\"standardMovieFormat\":\"$movieNaming\",
\"movieFolderFormat\":\"{Movie CleanTitle} ({Release Year})\",
\"includeQuality\":false,
\"replaceSpaces\":false,
\"id\":1
}"
log "Complete"
exit
Loading…
Cancel
Save