fix(plex): "Clear resume point" now tells Plex about an in-progress item

The button deletes the local row and mirrors the un-mark to Plex, but it decided whether
to push from the previous STATUS alone (prev_status != "new") — and an in-progress item's
row is status="new" carrying a position, which is exactly how the importer maps a bare
viewOffset. So for the single case the button exists for, nothing was ever sent to Plex:
the offset stayed, and the next pull imported it straight back. The user cleared Protector
twice and it returned to Continue watching at 92s both times.

Push now when Plex holds anything to clear — a view count, or a resume point. "hidden"
stays Siftlode-only and pushes nothing, which is what this endpoint's docstring always
claimed and the status-only guard contradicted.

One unscrobble clears BOTH viewCount and viewOffset — measured against the live server from
a watched+offset state and an offset-only one, so the push itself needed no change. The
client docstring that claimed "clears viewCount" is what sent the first diagnosis down a
wrong path (a timeline write with time=0, which does not clear an offset at all); it now
records what the server actually does.

Verified end to end on the real Plex server: the button leaves viewCount=None viewOffset=None,
and a full 44,885-item re-import brings back no row for it.
This commit is contained in:
2026-09-09 23:55:51 +02:00
parent 1630a3df3c
commit b8bff504d8
3 changed files with 100 additions and 2 deletions
+6 -1
View File
@@ -197,7 +197,12 @@ class PlexClient:
)
def unscrobble(self, rating_key: str) -> None:
"""Mark the item *unwatched* on the token's Plex account (clears viewCount)."""
"""Mark the item *unwatched* on the token's Plex account.
Clears the view count AND the resume point (`viewOffset`) — measured against the live server
on 2026-09-09, from both a watched+offset state and an offset-only one. This one call is the
whole un-mark; `/:/timeline?time=0` and `/:/progress?time=0` were both tried there and do
NOT clear an offset, so do not reach for them."""
self._write(
"GET",
f"/:/unscrobble?identifier={self._LIBRARY_IDENTIFIER}"