Fix play state sync, add manual stop detection, minor bug fixes
play_state_sync: fix TVDB episode lookup for Jellyfin 10.x — AnyProviderIdEquals returns the entire library for TVDB queries; switch to season+episode search with ProviderIds.Tvdb validation to find the correct episode. Also fix pkey extraction that was pulling s7e2 instead of the TVDB ID from tvdb:ep:5618559:s7e2. docker_watchdog: add automatic manual-stop detection — containers stopped cleanly (exit 0/143) are tracked in docker_watchdog_manual_stop.db and skipped until restarted, removing the need to add manually-stopped containers to the exclusion list. Auto-clears when the container is seen running again. docker_daily_restart: remove bare `local` declarations outside a function that were printing an error for every container restarted.
This commit is contained in:
@@ -435,14 +435,29 @@ for lname in "${!USER_MAP[@]}"; do
|
||||
if [[ -z "$_iid" ]]; then
|
||||
_ptype="${_pkey%%:*}"
|
||||
_pval="${_pkey##*:}"
|
||||
_search_field=""
|
||||
|
||||
case "$_ptype" in
|
||||
imdb) _search_field="imdb.${_pval}" ;;
|
||||
tmdb) _search_field="tmdb.${_pval##movie:}" ;;
|
||||
tvdb) _search_field="tvdb.${_pval%%:*}" ;;
|
||||
mb) _search_field="" ;; # skip music if not found
|
||||
tvdb)
|
||||
# AnyProviderIdEquals is unreliable for TVDB in Jellyfin 10.x —
|
||||
# returns the entire library. Search by season+episode instead,
|
||||
# then validate by ProviderIds.Tvdb.
|
||||
# pkey format: tvdb:ep:TVDB_EP_ID:sSEASONePEP
|
||||
_tvdb_ep_id="${_pkey#tvdb:ep:}"
|
||||
_tvdb_ep_id="${_tvdb_ep_id%%:*}"
|
||||
if [[ "$_pval" =~ ^s([0-9]+)e([0-9]+)$ ]]; then
|
||||
_iid=$(_api_get "${SRV_URL[$_si]}" "${SRV_KEY[$_si]}" \
|
||||
"Items?IncludeItemTypes=Episode&ParentIndexNumber=${BASH_REMATCH[1]}&IndexNumber=${BASH_REMATCH[2]}&Recursive=true&Fields=ProviderIds&Limit=500" 2>/dev/null \
|
||||
| jq -r --arg tvdb "$_tvdb_ep_id" \
|
||||
'.Items[] | select(.ProviderIds.Tvdb == $tvdb) | .Id' 2>/dev/null | head -1)
|
||||
fi
|
||||
;;
|
||||
mb) : ;; # skip music if not found
|
||||
esac
|
||||
|
||||
if [[ -n "$_search_field" ]]; then
|
||||
if [[ -z "$_iid" && -n "$_search_field" ]]; then
|
||||
_iid=$(_api_get "${SRV_URL[$_si]}" "${SRV_KEY[$_si]}" \
|
||||
"Items?AnyProviderIdEquals=${_search_field}&Recursive=true&Fields=ProviderIds&Limit=1" 2>/dev/null \
|
||||
| jq -r '.Items[0].Id // empty' 2>/dev/null)
|
||||
|
||||
Reference in New Issue
Block a user