Skip to content

Commit

Permalink
fix: tba sonarr problem solved question mark
Browse files Browse the repository at this point in the history
Signed-off-by: Devin Buhl <[email protected]>
  • Loading branch information
onedr0p committed Aug 9, 2024
1 parent 9bbe962 commit 5134622
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
5 changes: 4 additions & 1 deletion kubernetes/main/apps/default/sonarr/app/helmrelease.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,17 @@ spec:
persistence:
config:
existingClaim: sonarr
pushover-notify:
scripts:
type: configMap
name: sonarr-configmap
defaultMode: 0775
globalMounts:
- path: /scripts/pushover-notify.sh
subPath: pushover-notify.sh
readOnly: true
- path: /scripts/refresh-series.sh
subPath: refresh-series.sh
readOnly: true
tmp:
type: emptyDir
media:
Expand Down
1 change: 1 addition & 0 deletions kubernetes/main/apps/default/sonarr/app/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ configMapGenerator:
- name: sonarr-configmap
files:
- pushover-notify.sh=./resources/pushover-notify.sh
- refresh-series.sh=./resources/refresh-series.sh
generatorOptions:
disableNameSuffixHash: true
annotations:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
# shellcheck disable=SC2154

PUSHOVER_DEBUG="${PUSHOVER_DEBUG:-"false"}"
# kubectl port-forward service/sonarr -n default 8989:80
# export PUSHOVER_TOKEN="";
# export PUSHOVER_USER_KEY="";
# export sonarr_eventtype=Download;
# ./pushover-notify.sh

CONFIG_FILE="/config/config.xml" && [[ "${PUSHOVER_DEBUG}" == "true" ]] && CONFIG_FILE="config.xml"
ERRORS=()

#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# shellcheck disable=SC2154

if [[ "${sonarr_eventtype:-}" == "Grab" ]]; then
tba_count=$(curl -fsSL \
--header "X-Api-Key: ${SONARR__AUTH__APIKEY}" \
"http://localhost:${SONARR__SERVER__PORT}/api/v3/episode?seriesId=${sonarr_series_id}" \
| jq --raw-output '.[] | select((.title == "TBA") or (.title == "TBD"))' | jq --slurp 'length')

if (( tba_count > 0 )); then
echo "INFO: Refreshing series ${sonarr_series_id} due to TBA/TBD episodes found"
curl -fsSL \
--header "X-Api-Key: ${SONARR__AUTH__APIKEY}" \
--header "Content-Type: application/json" \
--data-binary '{"name": "RefreshSeries", "seriesId": '"${sonarr_series_id}"'}' \
--request POST "http://localhost:${SONARR__SERVER__PORT}/api/v3/command" &> /dev/null
fi
fi

0 comments on commit 5134622

Please sign in to comment.