Script audit: fix stale names, header mismatches, HOST1-hardcoded path maps in lidarr scripts
This commit is contained in:
@@ -197,11 +197,12 @@ fi
|
|||||||
DOCKER_TIMEOUT=15
|
DOCKER_TIMEOUT=15
|
||||||
LIDARR_CONTAINER="Lidarr" # container name on HOST1
|
LIDARR_CONTAINER="Lidarr" # container name on HOST1
|
||||||
|
|
||||||
# Build path map from HOST1_LIDARR_PATH_MAP for translate_path()
|
# Build path map from MY_ID's Lidarr path map
|
||||||
declare -A ARR_PATH_MAP
|
declare -A ARR_PATH_MAP
|
||||||
for key in "${!HOST1_LIDARR_PATH_MAP[@]}"; do
|
local_path_map_var="${MY_ID}_LIDARR_PATH_MAP"
|
||||||
ARR_PATH_MAP["$key"]="${HOST1_LIDARR_PATH_MAP[$key]}"
|
eval "for key in \"\${!${local_path_map_var}[@]}\"; do
|
||||||
done
|
ARR_PATH_MAP[\"\$key\"]=\"\${${local_path_map_var}[\$key]}\"
|
||||||
|
done"
|
||||||
|
|
||||||
# Validate required vars — detect_hosts() should have set these
|
# Validate required vars — detect_hosts() should have set these
|
||||||
require_var LIDARR_URL
|
require_var LIDARR_URL
|
||||||
|
|||||||
@@ -113,19 +113,20 @@ acquire_lock
|
|||||||
|
|
||||||
detect_hosts
|
detect_hosts
|
||||||
|
|
||||||
# Build path map for translate_path() — container path → host path
|
|
||||||
declare -A ARR_PATH_MAP
|
|
||||||
for _key in "${!HOST1_LIDARR_PATH_MAP[@]}"; do
|
|
||||||
ARR_PATH_MAP["$_key"]="${HOST1_LIDARR_PATH_MAP[$_key]}"
|
|
||||||
done
|
|
||||||
unset _key
|
|
||||||
|
|
||||||
# HOST guard — Lidarr runs on HOST1 only
|
# HOST guard — Lidarr runs on HOST1 only
|
||||||
if [[ -z "$LIDARR_URL" ]]; then
|
if [[ -z "$LIDARR_URL" ]]; then
|
||||||
echo "Lidarr not configured for $MY_ID — skipping"
|
echo "Lidarr not configured for $MY_ID — skipping"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Build path map from MY_ID's Lidarr path map
|
||||||
|
declare -A ARR_PATH_MAP
|
||||||
|
local_path_map_var="${MY_ID}_LIDARR_PATH_MAP"
|
||||||
|
eval "for _key in \"\${!${local_path_map_var}[@]}\"; do
|
||||||
|
ARR_PATH_MAP[\"\$_key\"]=\"\${${local_path_map_var}[\$_key]}\"
|
||||||
|
done"
|
||||||
|
unset _key
|
||||||
|
|
||||||
info "$MY_ID ($LOCAL_SERVER_NAME) — tools OK"
|
info "$MY_ID ($LOCAL_SERVER_NAME) — tools OK"
|
||||||
log "$ICON_GEAR Config: url=${LIDARR_URL}"
|
log "$ICON_GEAR Config: url=${LIDARR_URL}"
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# PURPOSE
|
# PURPOSE
|
||||||
# ─────────────────────────────────────────────────────────────────────────────
|
# ─────────────────────────────────────────────────────────────────────────────
|
||||||
# Triggered by Sonarr/Radarr/Lidarr OnUpgrade webhook (via webhook.php).
|
# Triggered by Sonarr/Radarr/Lidarr OnUpgrade webhook (via webhook_listener.js).
|
||||||
# Pushes the upgraded item folder to every other mesh node immediately, then
|
# Pushes the upgraded item folder to every other mesh node immediately, then
|
||||||
# triggers a library rescan on each remote arr so it accepts the new file as
|
# triggers a library rescan on each remote arr so it accepts the new file as
|
||||||
# ground truth without initiating a redundant quality search.
|
# ground truth without initiating a redundant quality search.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
# ============================= Delete Keys ====================================================
|
# ============================= Onboard Cancel =================================================
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
#
|
#
|
||||||
# PURPOSE
|
# PURPOSE
|
||||||
|
|||||||
@@ -1547,9 +1547,9 @@ _release_rsync_on_exit() {
|
|||||||
# Longest-match wins — prevents partial path collisions.
|
# Longest-match wins — prevents partial path collisions.
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# declare -A ARR_PATH_MAP=(["/ext-music"]="/mnt/user/Music-New")
|
# declare -A ARR_PATH_MAP=(["/ext-music"]="/mnt/user/Music")
|
||||||
# translate_path "/ext-music/Artist/Album/track.flac"
|
# translate_path "/ext-music/Artist/Album/track.flac"
|
||||||
# Returns: /mnt/user/Music-New/Artist/Album/track.flac
|
# Returns: /mnt/user/Music/Artist/Album/track.flac
|
||||||
#
|
#
|
||||||
# If no match found — returns path unchanged (safe fallback).
|
# If no match found — returns path unchanged (safe fallback).
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user