Stop trusting Plex's Date Added on its own
Jess spotted that dates looked like file dates rather than library-add dates. He is right, and MediaShelf was not the culprit: it reproduces Plex's addedAt exactly (verified 500/500 identical to the second). Plex's own field is what follows the file — replace or re-encode one and Date Added resets while the item, its ratingKey and its watch history all survive. Measured on the live library, comparing addedAt against lastViewedAt where both exist: 55 of 509 movies (10.8%) and 306 of 1,393 TV Show Archive items (22.0%) were watched BEFORE they were "added" — 19% overall. 2001: A Space Odyssey reports added 2026-07-31, last watched 2017-08-26. That is not cosmetic. pre_history is derived from added_at, so an old item whose file was replaced looks post-coverage and gets promoted into the CONFIDENT reclaim pool, which is the one pool meant to be trustworthy. A completed play proves the item already existed, so added_at is now MIN(provider_added_at, first_watched_at). Plex's raw value is kept in provider_added_at, added_at_source records which applied, and the item drawer explains the substitution instead of quietly disagreeing with Plex. Unwatched items keep Plex's value since nothing contradicts it. first_seen_at is also recorded now and is authoritative for anything added from here on. Plex's API has no better field; the true insert time is only in Plex's own metadata_items.created_at on Loki. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GVbG48GAXfCZatcmX123Ra
This commit is contained in:
parent
d12cbc62ee
commit
e819548ff2
9 changed files with 234 additions and 15 deletions
|
|
@ -156,6 +156,7 @@ td.title-cell { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
|
|||
.flag.duplicate { color: var(--accent); border-color: var(--accent); }
|
||||
.flag.kept { color: var(--kept); border-color: var(--kept); }
|
||||
.flag.multi_part, .flag.history_gap { color: var(--faint); border-color: var(--faint); }
|
||||
.flag.added_corrected { color: var(--accent); border-color: var(--accent); opacity: .8; }
|
||||
|
||||
.pager { display: flex; gap: .6rem; align-items: center; justify-content: center; padding: .7rem; color: var(--dim); font-size: .85rem; }
|
||||
|
||||
|
|
|
|||
|
|
@ -551,7 +551,15 @@ async function openItem(id) {
|
|||
const add = (k, v) => { dl.append(el('dt', { text: k }), el('dd', { text: v })); };
|
||||
add('Library', it.library.title);
|
||||
add('Size', `${bytes(it.size_bytes)} (${exact(it.size_bytes)})`);
|
||||
add('Added', date(it.added_at));
|
||||
if (it.added_at_source === 'first_watch') {
|
||||
add('Added', `${date(it.added_at)} (corrected)`);
|
||||
add('', `Plex reports ${date(it.provider_added_at)}, but it was already being ` +
|
||||
`watched before then — Plex's Date Added follows the file, so replacing ` +
|
||||
`or re-encoding one resets it. The first play is used as a lower bound.`);
|
||||
} else {
|
||||
add('Added', date(it.added_at));
|
||||
}
|
||||
if (it.first_seen_at) add('First seen by MediaShelf', date(it.first_seen_at));
|
||||
add('Last played', it.last_watched_at ? `${date(it.last_watched_at)} (${agoPhrase(it.last_watched_at)})` : 'never');
|
||||
add('Plays', `${it.watch_count} finished · ${it.partial_count} partial · ${it.abandoned_count} abandoned`);
|
||||
add('Distinct viewers', it.distinct_watcher_count);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue