added other variables to check in the arrs. if it isnt importing for what ever reason blocklist and search
This commit is contained in:
@@ -6,9 +6,13 @@
|
|||||||
# across Sonarr, Radarr, and Lidarr. Blocklists the bad release and triggers
|
# across Sonarr, Radarr, and Lidarr. Blocklists the bad release and triggers
|
||||||
# a new search — hands free recovery while you sleep.
|
# a new search — hands free recovery while you sleep.
|
||||||
#
|
#
|
||||||
# Targets two problem types from the queue API:
|
# Targets four problem types from the queue API:
|
||||||
# importFailed — downloaded successfully but arr couldn't import the file
|
# importFailed — downloaded successfully but arr couldn't import the file
|
||||||
# stalled — download stuck with no connections or no progress
|
# importPending — downloaded, stuck waiting to import (won't self-resolve)
|
||||||
|
# error status — serious failure not covered by importFailed/importPending
|
||||||
|
# stalled — download stuck with no connections or no progress
|
||||||
|
#
|
||||||
|
# Never touches items with state "downloading" or "imported" — safe to run anytime.
|
||||||
#
|
#
|
||||||
# Action per problem item:
|
# Action per problem item:
|
||||||
# 1. Blocklist the release — prevents re-grabbing the same bad release
|
# 1. Blocklist the release — prevents re-grabbing the same bad release
|
||||||
@@ -168,17 +172,27 @@ process_arr() {
|
|||||||
total_records=$(echo "$queue_data" | jq '.totalRecords // 0' 2>/dev/null)
|
total_records=$(echo "$queue_data" | jq '.totalRecords // 0' 2>/dev/null)
|
||||||
info "Queue: $total_records total items"
|
info "Queue: $total_records total items"
|
||||||
|
|
||||||
# Filter for problem items — importFailed or stalled
|
# Filter for problem items — never touch downloading or imported
|
||||||
|
# importFailed = tried to import, actually failed
|
||||||
|
# importPending = downloaded, stuck waiting to import (won't self-resolve)
|
||||||
|
# error status = serious failure not covered by above states
|
||||||
|
# stalled = download stuck with no connections or progress
|
||||||
local problem_items
|
local problem_items
|
||||||
problem_items=$(echo "$queue_data" | jq -c '
|
problem_items=$(echo "$queue_data" | jq -c '
|
||||||
.records // [] |
|
.records // [] |
|
||||||
.[] |
|
.[] |
|
||||||
select(
|
select(
|
||||||
.trackedDownloadState == "importFailed" or
|
.trackedDownloadState != "downloading" and
|
||||||
(.status == "warning" and (
|
.trackedDownloadState != "imported" and
|
||||||
(.errorMessage // "" | ascii_downcase | contains("stalled")) or
|
(
|
||||||
(.statusMessages // [] | .[] | .messages // [] | .[] | ascii_downcase | contains("stalled"))
|
.trackedDownloadState == "importFailed" or
|
||||||
))
|
.trackedDownloadState == "importPending" or
|
||||||
|
.trackedDownloadStatus == "error" or
|
||||||
|
(.status == "warning" and (
|
||||||
|
(.errorMessage // "" | ascii_downcase | contains("stalled")) or
|
||||||
|
(.statusMessages // [] | .[] | .messages // [] | .[] | ascii_downcase | contains("stalled"))
|
||||||
|
))
|
||||||
|
)
|
||||||
)
|
)
|
||||||
' 2>/dev/null)
|
' 2>/dev/null)
|
||||||
|
|
||||||
@@ -201,14 +215,21 @@ process_arr() {
|
|||||||
title=$(echo "$item" | jq -r '.title // "Unknown"' 2>/dev/null)
|
title=$(echo "$item" | jq -r '.title // "Unknown"' 2>/dev/null)
|
||||||
added=$(echo "$item" | jq -r '.added // empty' 2>/dev/null)
|
added=$(echo "$item" | jq -r '.added // empty' 2>/dev/null)
|
||||||
|
|
||||||
# Determine problem type
|
# Determine problem type for display
|
||||||
local tracked_state
|
local tracked_state tracked_status
|
||||||
tracked_state=$(echo "$item" | jq -r '.trackedDownloadState // ""' 2>/dev/null)
|
tracked_state=$(echo "$item" | jq -r '.trackedDownloadState // ""' 2>/dev/null)
|
||||||
if [[ "$tracked_state" == "importFailed" ]]; then
|
tracked_status=$(echo "$item" | jq -r '.trackedDownloadStatus // ""' 2>/dev/null)
|
||||||
problem_type="import failed"
|
case "$tracked_state" in
|
||||||
else
|
importFailed) problem_type="import failed" ;;
|
||||||
problem_type="stalled"
|
importPending) problem_type="import pending/stuck" ;;
|
||||||
fi
|
*)
|
||||||
|
if [[ "$tracked_status" == "error" ]]; then
|
||||||
|
problem_type="error"
|
||||||
|
else
|
||||||
|
problem_type="stalled"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Get media ID for search trigger (episode, movie, or album)
|
# Get media ID for search trigger (episode, movie, or album)
|
||||||
case "$arr_type" in
|
case "$arr_type" in
|
||||||
@@ -319,6 +340,8 @@ echo "$ICON_TIME Duration: $(format_duration $(( END - START )))"
|
|||||||
echo "$ICON_TRASH Actioned: $TOTAL_ACTIONED items blocklisted + searched"
|
echo "$ICON_TRASH Actioned: $TOTAL_ACTIONED items blocklisted + searched"
|
||||||
echo "$ICON_RUNNING Skipped: $TOTAL_SKIPPED items (too new or unreachable)"
|
echo "$ICON_RUNNING Skipped: $TOTAL_SKIPPED items (too new or unreachable)"
|
||||||
echo ""
|
echo ""
|
||||||
|
echo " Problem types detected: importFailed | importPending | error | stalled"
|
||||||
|
echo ""
|
||||||
|
|
||||||
for summary in "${ARR_SUMMARIES[@]}"; do
|
for summary in "${ARR_SUMMARIES[@]}"; do
|
||||||
echo " $ICON_SUMMARY $summary"
|
echo " $ICON_SUMMARY $summary"
|
||||||
|
|||||||
Reference in New Issue
Block a user