fix(plex): a refused finish restores no resume point at the media's own end
The rollback of a refused watched mark guarded against Plex's REPORTED duration. On a file shorter than its metadata the end sits outside the finish margin, so playing to the end and having the mark refused stored the very end as a resume point on an unwatched row: a ~99% bar that reopened in the last seconds. The media's own ended flag now decides.
This commit is contained in:
@@ -215,6 +215,10 @@ export function usePlexProgress(opts: {
|
||||
// Watched badge the server disagreed with (round 5).
|
||||
const pos = Math.floor(absRef.current);
|
||||
const dur = durationRef.current;
|
||||
// The media's own end, not Plex's reported duration: a file shorter than its metadata (a
|
||||
// configuration this file documents) ends outside the margin below, and restoring THAT
|
||||
// position left an unwatched item with a ~99% bar that reopened in its last seconds.
|
||||
const ended = video?.ended === true;
|
||||
void confirmed?.catch(() => {
|
||||
finishRefused = true;
|
||||
// Restore the resume point the finish replaced — but ONLY where there is one to restore.
|
||||
@@ -224,7 +228,7 @@ export function usePlexProgress(opts: {
|
||||
// performed, through a second route, exactly the write that had just been refused — while
|
||||
// the caller's error toast was already on screen saying it had failed (round 6). The
|
||||
// credits-skip caller captures a mid-episode position and is unaffected.
|
||||
if (pos > 0 && dur > 0 && pos <= dur - FINISH_MARGIN_S)
|
||||
if (!ended && pos > 0 && dur > 0 && pos <= dur - FINISH_MARGIN_S)
|
||||
api.plexProgress(id, pos, dur, true).catch(() => {});
|
||||
// `settle` may already have patched the detail to watched / 0 on the way out. Dropping that
|
||||
// entry rather than invalidating it: an invalidated query with no observer keeps serving its
|
||||
|
||||
Reference in New Issue
Block a user