Add Rsync page, upgrade monitor rsync card, partnership overhaul, API key periodic check, docker watchdog manual-stop detection
This commit is contained in:
+17
-18
@@ -435,29 +435,19 @@ 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)
|
||||
# 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
|
||||
# _pkey format: tvdb:ep:{tvdb_id}:s{season}e{ep}
|
||||
# ##*: gives "s7e2" (wrong); strip prefix then first :
|
||||
_tvdb_num="${_pkey#tvdb:ep:}"; _tvdb_num="${_tvdb_num%%:*}"
|
||||
_search_field="tvdb.${_tvdb_num}"
|
||||
;;
|
||||
mb) : ;; # skip music if not found
|
||||
mb) _search_field="" ;; # skip music if not found
|
||||
esac
|
||||
|
||||
if [[ -z "$_iid" && -n "$_search_field" ]]; then
|
||||
if [[ -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)
|
||||
@@ -477,8 +467,17 @@ for lname in "${!USER_MAP[@]}"; do
|
||||
if [[ "$_auth_played" == "true" ]]; then
|
||||
# Mark as played with date
|
||||
_date_param=""
|
||||
[[ "$_auth_lplayed" != "null" && -n "$_auth_lplayed" ]] && \
|
||||
_date_param="?DatePlayed=${_auth_lplayed//[: ]/%3A}"
|
||||
if [[ "$_auth_lplayed" != "null" && -n "$_auth_lplayed" ]]; then
|
||||
# Emby's PlayedItems endpoint rejects 7-digit fractional seconds (.0000000)
|
||||
# with HTTP 500; strip to whole seconds before encoding
|
||||
if [[ "$_auth_lplayed" == *.* ]]; then
|
||||
_lp="${_auth_lplayed%.*}"
|
||||
[[ "$_auth_lplayed" == *Z ]] && _lp+="Z"
|
||||
else
|
||||
_lp="$_auth_lplayed"
|
||||
fi
|
||||
_date_param="?DatePlayed=${_lp//[: ]/%3A}"
|
||||
fi
|
||||
_http=$(_api_post "${SRV_URL[$_si]}" "${SRV_KEY[$_si]}" \
|
||||
"Users/${_uid}/PlayedItems/${_iid}${_date_param}")
|
||||
if [[ "$_http" == "200" || "$_http" == "201" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user