Kill kill kill kill kill

This commit is contained in:
emily 2024-11-26 22:01:19 +01:00
parent 69b82a3497
commit c3f9bd4fdd
Signed by: emily
GPG key ID: F6F4C66207FCF995
11 changed files with 666 additions and 734 deletions

View file

@ -5,6 +5,9 @@ downloadPath="/config/extended/downloads" # OPTIONAL, only change if needed....
importPath="/config/extended/import" # OPTIONAL, only change if needed.... Completed downloads are stored here for the Usenet Blackhole client to import from. When Using queue cleaner, failed imports will be automatically cleaned up.
videoPath="" # Final destination/location of completed Videos
arrUrl="http://127.0.0.1:8686/lidarr"
arrApiKeyPath=""
##### SCRIPT ENABLEMENT
enableAutoConfig="true" # true = enabled :: Automatically configures Lidarr with optimal settings
enableAudio="true" # true = enabled :: Enables the Audio script to run automatically

File diff suppressed because it is too large Load diff

View file

@ -5,18 +5,9 @@ log () {
getArrAppInfo () {
# Get Arr App information
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/\///")"
fi
arrName="$(cat /config/config.xml | xq | jq -r .Config.InstanceName)"
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
# shellcheck source=../config/extended.conf
source "$1/extended.conf"
arrApiKey="$(cat "$arrApiKeyPath")"
}
verifyApiAccess () {
@ -35,26 +26,8 @@ verifyApiAccess () {
if [ -n "$arrApiTest" ]; then
break
else
log "$arrName is not ready, sleeping until valid response..."
log "Not ready, sleeping until valid response..."
sleep 1
fi
done
}
ConfValidationCheck () {
if [ ! -f "/config/extended.conf" ]; then
log "ERROR :: \"extended.conf\" file is missing..."
log "ERROR :: Download the extended.conf config file and place it into \"/config\" folder..."
log "ERROR :: Exiting..."
exit
fi
if [ -z "$enableAutoConfig" ]; then
log "ERROR :: \"extended.conf\" file is unreadable..."
log "ERROR :: Likely caused by editing with a non unix/linux compatible editor, to fix, replace the file with a valid one or correct the line endings..."
log "ERROR :: Exiting..."
exit
fi
}
logfileSetup
ConfValidationCheck

View file

@ -31,30 +31,12 @@ QueueCleanerProcess () {
arrQueueData=""
arrApp=""
# Sonarr
if [ -z "$arrQueueData" ]; then
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=200&sortDirection=descending&sortKey=progress&includeUnknownSeriesItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrApp="sonarr"
fi
# Radarr
if [ -z "$arrQueueData" ]; then
arrQueueData="$(curl -s "$arrUrl/api/v3/queue?page=1&pagesize=200&sortDirection=descending&sortKey=progress&includeUnknownMovieItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrApp="radarr"
fi
# Lidarr
if [ -z "$arrQueueData" ]; then
arrQueueData="$(curl -s "$arrUrl/api/v1/queue?page=1&pagesize=200&sortDirection=descending&sortKey=progress&includeUnknownArtistItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrApp="lidarr"
fi
# Readarr
if [ -z "$arrQueueData" ]; then
arrQueueData="$(curl -s "$arrUrl/api/v1/queue?page=1&pagesize=200&sortDirection=descending&sortKey=progress&includeUnknownAuthorItems=true&apikey=${arrApiKey}" | jq -r .records[])"
arrApp="readarr"
fi
arrQueueIdCount=$(echo "$arrQueueData" | jq -r ".id" | wc -l)
arrQueueCompletedIds=$(echo "$arrQueueData" | jq -r 'select(.status=="completed") | select(.trackedDownloadStatus=="warning") | .id')
arrQueueIdsCompletedCount=$(echo -n "$arrQueueCompletedIds" | wc -l)
@ -88,7 +70,7 @@ QueueCleanerProcess () {
continue
fi
fi
log "$queueId ($arrQueueItemTitle) :: Removing Failed Queue Item from $arrName..."
log "$queueId ($arrQueueItemTitle) :: Removing Failed Queue Item..."
deleteItem=$(curl -sX DELETE "$arrUrl/api/$arrApiVersion/queue/$queueId?removeFromClient=true&blocklist=true&apikey=${arrApiKey}")
done
fi