diff --git a/Media/play_state_sync.sh b/Media/play_state_sync.sh index 158d0d6..d8e2b58 100755 --- a/Media/play_state_sync.sh +++ b/Media/play_state_sync.sh @@ -450,7 +450,7 @@ for lname in "${!USER_MAP[@]}"; do 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 \ + "Items?AnyProviderIdEquals=${_search_field}&Recursive=true&Fields=ProviderIds&ExcludeLocationTypes=Virtual&Limit=1" 2>/dev/null \ | jq -r '.Items[0].Id // empty' 2>/dev/null) fi [[ -z "$_iid" ]] && log " SKIP $_pkey → ${SRV_NAME[$_si]} item not found on server" && continue @@ -469,15 +469,10 @@ for lname in "${!USER_MAP[@]}"; do # Mark as played with date _date_param="" 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}" + # PlayedItems expects DatePlayed in yyyyMMddHHmmss (no separators, no timezone) + _lp="${_auth_lplayed%.*}" + _lp="${_lp%Z}" + _date_param="?DatePlayed=${_lp//[-T:]/}" fi _http=$(_api_post "${SRV_URL[$_si]}" "${SRV_KEY[$_si]}" \ "Users/${_uid}/PlayedItems/${_iid}${_date_param}")