You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.3 KiB
72 lines
2.3 KiB
#!/usr/bin/env bash
|
|
scriptVersion="1.0.002"
|
|
|
|
if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then
|
|
arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)"
|
|
if [ "$arrUrlBase" == "null" ]; then
|
|
arrUrlBase=""
|
|
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..."
|
|
updateArr=$(curl -s "$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"
|
|
|
|
log "Updating Radarr Media Management..."
|
|
updateArr=$(curl -s "$arrUrl/api/v3/config/mediamanagement" -X PUT -H "Content-Type: application/json" -H "X-Api-Key: $arrApiKey" --data-raw '{
|
|
"autoUnmonitorPreviouslyDownloadedMovies":false,
|
|
"recycleBin":"",
|
|
"recycleBinCleanupDays":7,
|
|
"downloadPropersAndRepacks":"doNotPrefer",
|
|
"createEmptyMovieFolders":false,
|
|
"deleteEmptyFolders":true,
|
|
"fileDate":"none",
|
|
"rescanAfterRefresh":"always",
|
|
"autoRenameFolders":false,
|
|
"pathsDefaultStatic":false,
|
|
"setPermissionsLinux":true,
|
|
"chmodFolder":"777",
|
|
"chownGroup":"666",
|
|
"skipFreeSpaceCheckWhenImporting":false,
|
|
"minimumFreeSpaceWhenImporting":100,
|
|
"copyUsingHardlinks":true,
|
|
"importExtraFiles":true,
|
|
"extraFileExtensions":"srt",
|
|
"enableMediaInfo":true,
|
|
"id":1
|
|
}')
|
|
log "Complete"
|
|
|
|
exit
|