From 4e4ef8f541a9992219a7a8d1db0c316e3b76a806 Mon Sep 17 00:00:00 2001 From: RandomNinjaAtk Date: Mon, 5 Sep 2022 20:34:04 -0400 Subject: [PATCH] Update AutoConfig.bash --- root/scripts/AutoConfig.bash | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/root/scripts/AutoConfig.bash b/root/scripts/AutoConfig.bash index a5bcc1f..8cc0560 100644 --- a/root/scripts/AutoConfig.bash +++ b/root/scripts/AutoConfig.bash @@ -1,5 +1,5 @@ #!/usr/bin/env bash -scriptVersion="1.0.000" +scriptVersion="1.0.001" if [ -z "$arrUrl" ] || [ -z "$arrApiKey" ]; then arrUrlBase="$(cat /config/config.xml | xq | jq -r .Config.UrlBase)" @@ -90,4 +90,16 @@ else log "Complete" fi +if curl -s "$arrUrl/api/v3/notification" -H "X-Api-Key: ${arrApiKey}" | jq -r .[].name | grep "DailySeriesEpisodeTrimmer.bash" | read; then + log "DailySeriesEpisodeTrimmer.bash already added to Sonarr custom scripts" +else + log "Adding DailySeriesEpisodeTrimmer.bash to Sonarr custom scripts" + # Send a command to check file path, to prevent error with adding... + updateArr=$(curl -s "$arrUrl/api/v3/filesystem?path=%2Fconfig%2Fextended%2Fscripts%2FDailySeriesEpisodeTrimmer.bash&allowFoldersWithoutTrailingSlashes=true&includeFiles=true" -H "X-Api-Key: ${arrApiKey}") + + # Add DailySeriesEpisodeTrimmer.bash + updateArr=$(curl -s "$arrUrl/api/v3/notification?" -X POST -H "Content-Type: application/json" -H "X-Api-Key: ${arrApiKey}" --data-raw '{"onGrab":false,"onDownload":true,"onUpgrade":true,"onRename":true,"onSeriesDelete":true,"onEpisodeFileDelete":true,"onEpisodeFileDeleteForUpgrade":true,"onHealthIssue":false,"onApplicationUpdate":false,"supportsOnGrab":true,"supportsOnDownload":true,"supportsOnUpgrade":true,"supportsOnRename":true,"supportsOnSeriesDelete":true,"supportsOnEpisodeFileDelete":true,"supportsOnEpisodeFileDeleteForUpgrade":true,"supportsOnHealthIssue":true,"supportsOnApplicationUpdate":true,"includeHealthWarnings":false,"name":"DailySeriesEpisodeTrimmer.bash","fields":[{"name":"path","value":"/config/extended/scripts/DailySeriesEpisodeTrimmer.bash"},{"name":"arguments"}],"implementationName":"Custom Script","implementation":"CustomScript","configContract":"CustomScriptSettings","infoLink":"https://wiki.servarr.com/sonarr/supported#customscript","message":{"message":"Testing will execute the script with the EventType set to Test, ensure your script handles this correctly","type":"warning"},"tags":[]}') + log "Complete" +fi + exit