Generalize tracked-data cache from Lidarr-only to all three arrs

Shared cache/rescan-duration logic in common.sh now takes an arr_type
param instead of being Lidarr-specific, so Sonarr and Radarr cleanup
scripts get the same cache-first fetch + rescan-aware retry Lidarr had.
Avoids redundant full-library API calls across scripts run back to back,
and stops false failures when a fetch lands mid-rescan.
This commit is contained in:
Gmer4Lfe
2026-07-16 15:34:56 -04:00
parent 62bb166f9a
commit c7ecf99c3f
10 changed files with 430 additions and 236 deletions
+2 -2
View File
@@ -256,8 +256,8 @@ echo "━━━ $ICON_SYNC Building Album Directory Map ━━━"
declare -A ALBUM_DIR_MAP
_artist_list=$(curl_json "$LIDARR_URL/api/v1/artist?apikey=$LIDARR_API_KEY")
# Write-through — keeps the shared tracked-data cache fresh as a side effect of a fetch
# this script already needed for its own purposes. See lidarr_get_tracked_data() in common.sh.
lidarr_cache_write "$_artist_list"
# this script already needed for its own purposes. See arr_get_tracked_data() in common.sh.
arr_cache_write "lidarr" "$_artist_list"
_map_artist_count=$(echo "$_artist_list" | jq '. | length')
info "Fetching track files for $_map_artist_count artists..."