audit and clean master.conf, common.sh, and emby sync tools
master.conf: - reorder ORCHESTRATORS section by run frequency; add missing entries - remove heartbeat vars (watchdogs no longer run in continuous cycle) - remove dead REMOTE_DOCKER_RETRY_WAIT and display-only watchdog interval vars - move INTERMEDIATE_RSYNC_ENABLED into RSYNC two-tier block; reorder by frequency common.sh: - add missing info() and success() definitions — both were called throughout but never defined - update output tier description to list all 5 functions - fix double-icon in check_local_disk_temps() error/warn calls - fix smashed curl/ssh command lines in notify_emby_scan() and check_remote_docker_daemon() - update check_rsync_enabled() comment to include INTERMEDIATE, ordered by frequency emby_to_radarr_sync.sh / emby_to_sonarr_sync.sh: - wire up RADARR_EMBY_LIBRARIES / SONARR_EMBY_LIBRARIES; empty array now scans all libraries
This commit is contained in:
@@ -38,9 +38,10 @@
|
||||
# without modification. Safe to run multiple times — the second run finds nothing to add.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# CONFIGURATION (host*.conf)
|
||||
# CONFIGURATION (master.conf / host*.conf)
|
||||
# ==============================================================================================
|
||||
#
|
||||
# RADARR_EMBY_LIBRARIES — Emby library names to scan (master.conf); empty = all libraries
|
||||
# HOST*_RADARR_URL / HOST*_RADARR_API_KEY — Radarr connection (aliased by detect_hosts)
|
||||
# HOST*_EMBY_URL / HOST*_EMBY_API_KEY — Emby connection (aliased by detect_hosts)
|
||||
#
|
||||
@@ -156,18 +157,39 @@ echo "$ICON_HOST $MY_ID ($LOCAL_SERVER_NAME)"
|
||||
echo ""
|
||||
echo "━━━ $ICON_SYNC Emby Movie Library ━━━"
|
||||
|
||||
EMBY_MOVIES_JSON=$(_emby_api "Items?IncludeItemTypes=Movie&Recursive=true&Fields=ProviderIds&Limit=10000") || {
|
||||
error "Could not fetch Emby movies"
|
||||
exit 1
|
||||
}
|
||||
|
||||
declare -A EMBY_MOVIES # name → tmdb_id (empty string if none)
|
||||
|
||||
while IFS='|' read -r name tmdb_id; do
|
||||
[[ -z "$name" || "$name" == "null" ]] && continue
|
||||
_is_episode_title "$name" && { log " $ICON_SKIP Skipping episode/garbage: $name"; continue; }
|
||||
EMBY_MOVIES["$name"]="$tmdb_id"
|
||||
done < <(echo "$EMBY_MOVIES_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tmdb // "")] | join("|")' 2>/dev/null)
|
||||
if [[ "${#RADARR_EMBY_LIBRARIES[@]}" -gt 0 ]]; then
|
||||
LIBRARIES_JSON=$(_emby_api "Library/VirtualFolders") || { error "Could not fetch Emby libraries"; exit 1; }
|
||||
for lib_name in "${RADARR_EMBY_LIBRARIES[@]}"; do
|
||||
lib_id=$(echo "$LIBRARIES_JSON" | jq -r --arg n "$lib_name" '.[] | select(.Name == $n) | .ItemId' 2>/dev/null)
|
||||
if [[ -z "$lib_id" ]]; then
|
||||
warn "Emby library not found: $lib_name"
|
||||
continue
|
||||
fi
|
||||
log "Scanning library: $lib_name (ItemId: $lib_id)"
|
||||
LIB_JSON=$(_emby_api "Items?ParentId=${lib_id}&IncludeItemTypes=Movie&Recursive=true&Fields=ProviderIds&Limit=5000") || {
|
||||
warn "Could not fetch movies from library: $lib_name"
|
||||
continue
|
||||
}
|
||||
while IFS='|' read -r name tmdb_id; do
|
||||
[[ -z "$name" || "$name" == "null" ]] && continue
|
||||
_is_episode_title "$name" && { log " $ICON_SKIP Skipping episode/garbage: $name"; continue; }
|
||||
EMBY_MOVIES["$name"]="$tmdb_id"
|
||||
done < <(echo "$LIB_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tmdb // "")] | join("|")' 2>/dev/null)
|
||||
done
|
||||
else
|
||||
log "RADARR_EMBY_LIBRARIES empty — scanning all Emby libraries"
|
||||
EMBY_MOVIES_JSON=$(_emby_api "Items?IncludeItemTypes=Movie&Recursive=true&Fields=ProviderIds&Limit=10000") || {
|
||||
error "Could not fetch Emby movies"
|
||||
exit 1
|
||||
}
|
||||
while IFS='|' read -r name tmdb_id; do
|
||||
[[ -z "$name" || "$name" == "null" ]] && continue
|
||||
_is_episode_title "$name" && { log " $ICON_SKIP Skipping episode/garbage: $name"; continue; }
|
||||
EMBY_MOVIES["$name"]="$tmdb_id"
|
||||
done < <(echo "$EMBY_MOVIES_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tmdb // "")] | join("|")' 2>/dev/null)
|
||||
fi
|
||||
|
||||
EMBY_COUNT=${#EMBY_MOVIES[@]}
|
||||
log "$EMBY_COUNT movies in Emby library"
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
# CONFIGURATION (master.conf / host*.conf)
|
||||
# ==============================================================================================
|
||||
#
|
||||
# SONARR_EMBY_LIBRARIES — Emby library names to scan (master.conf)
|
||||
# SONARR_EMBY_LIBRARIES — Emby library names to scan (master.conf); empty = all libraries
|
||||
# HOST*_SONARR_URL / HOST*_SONARR_API_KEY — Sonarr connection (aliased by detect_hosts)
|
||||
# HOST*_EMBY_URL / HOST*_EMBY_API_KEY — Emby connection (aliased by detect_hosts)
|
||||
#
|
||||
@@ -151,33 +151,39 @@ echo "$ICON_HOST $MY_ID ($LOCAL_SERVER_NAME)"
|
||||
echo ""
|
||||
echo "━━━ $ICON_SYNC Emby Series Library ━━━"
|
||||
|
||||
if [[ "${#SONARR_EMBY_LIBRARIES[@]}" -eq 0 ]]; then
|
||||
error "SONARR_EMBY_LIBRARIES not configured — check master.conf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Fetch library list and resolve names → ItemIds
|
||||
LIBRARIES_JSON=$(_emby_api "Library/VirtualFolders") || { error "Could not fetch Emby libraries"; exit 1; }
|
||||
|
||||
declare -A EMBY_SERIES # name → tvdb_id (empty string if none)
|
||||
|
||||
for lib_name in "${SONARR_EMBY_LIBRARIES[@]}"; do
|
||||
lib_id=$(echo "$LIBRARIES_JSON" | jq -r --arg n "$lib_name" '.[] | select(.Name == $n) | .ItemId' 2>/dev/null)
|
||||
if [[ -z "$lib_id" ]]; then
|
||||
warn "Emby library not found: $lib_name"
|
||||
continue
|
||||
fi
|
||||
log "Scanning library: $lib_name (ItemId: $lib_id)"
|
||||
LIB_JSON=$(_emby_api "Items?ParentId=${lib_id}&IncludeItemTypes=Series&Recursive=true&Fields=ProviderIds&Limit=5000") || {
|
||||
warn "Could not fetch series from library: $lib_name"
|
||||
continue
|
||||
if [[ "${#SONARR_EMBY_LIBRARIES[@]}" -gt 0 ]]; then
|
||||
LIBRARIES_JSON=$(_emby_api "Library/VirtualFolders") || { error "Could not fetch Emby libraries"; exit 1; }
|
||||
for lib_name in "${SONARR_EMBY_LIBRARIES[@]}"; do
|
||||
lib_id=$(echo "$LIBRARIES_JSON" | jq -r --arg n "$lib_name" '.[] | select(.Name == $n) | .ItemId' 2>/dev/null)
|
||||
if [[ -z "$lib_id" ]]; then
|
||||
warn "Emby library not found: $lib_name"
|
||||
continue
|
||||
fi
|
||||
log "Scanning library: $lib_name (ItemId: $lib_id)"
|
||||
LIB_JSON=$(_emby_api "Items?ParentId=${lib_id}&IncludeItemTypes=Series&Recursive=true&Fields=ProviderIds&Limit=5000") || {
|
||||
warn "Could not fetch series from library: $lib_name"
|
||||
continue
|
||||
}
|
||||
while IFS='|' read -r name tvdb_id; do
|
||||
[[ -z "$name" || "$name" == "null" ]] && continue
|
||||
_is_garbage_title "$name" && { log " $ICON_SKIP Skipping garbage title: $name"; continue; }
|
||||
EMBY_SERIES["$name"]="$tvdb_id"
|
||||
done < <(echo "$LIB_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tvdb // "")] | join("|")' 2>/dev/null)
|
||||
done
|
||||
else
|
||||
log "SONARR_EMBY_LIBRARIES empty — scanning all Emby libraries"
|
||||
ALL_JSON=$(_emby_api "Items?IncludeItemTypes=Series&Recursive=true&Fields=ProviderIds&Limit=5000") || {
|
||||
error "Could not fetch Emby series"
|
||||
exit 1
|
||||
}
|
||||
while IFS='|' read -r name tvdb_id; do
|
||||
[[ -z "$name" || "$name" == "null" ]] && continue
|
||||
_is_garbage_title "$name" && { log " $ICON_SKIP Skipping garbage title: $name"; continue; }
|
||||
EMBY_SERIES["$name"]="$tvdb_id"
|
||||
done < <(echo "$LIB_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tvdb // "")] | join("|")' 2>/dev/null)
|
||||
done
|
||||
done < <(echo "$ALL_JSON" | jq -r '.Items[] | [.Name, (.ProviderIds.Tvdb // "")] | join("|")' 2>/dev/null)
|
||||
fi
|
||||
|
||||
EMBY_COUNT=${#EMBY_SERIES[@]}
|
||||
log "$EMBY_COUNT series in Emby library"
|
||||
|
||||
Reference in New Issue
Block a user