Skip to content

The player of every Plex play, and the moods of every artist - #241

Merged
Randomname653 merged 3 commits into
mainfrom
claude/plex-player
Oct 25, 2026
Merged

Randomname653 merged 3 commits into
mainfrom
claude/plex-player

Conversation

@Randomname653

Copy link
Copy Markdown
Owner

What & why

This is the groundwork for the Wrap-Up's rhythm clock and the "phone after midnight" story (priority 6 in docs/WRAPUP_V2_BLUEPRINT.md). It was measured against the real Plex server, read only.

The player of a play

  • Every Plex history event names its device (deviceID). /devices maps that to a name and a platform ("iPhone" / "iOS", "Chromecast Google TV" / "Android").
  • Nothing stored it: platform was only ever filled from Spotify.
  • New plays: the sync and the history (orphan) import write player (new column) and platform for every Plex play.
    • plex_sync.fetch_players reads /devices once a sync.
    • player_of takes a play's own event, else the same item's event within 90 s.
  • Stored plays: a one-time custodian job, plex_players (no model), fills them from the whole history Plex still holds.
    • Most music events on the real server no longer carry a ratingKey, because the track was re-added. So a stored play is also found by its second (±2 s) and title.
  • On a copy of the NAS backup:
    • about 19,000 music plays got their player (Desktop/Windows, Android, two Pixels), plus the anime and show plays still in Plex's history;
    • 968 plays were on a phone between midnight and 5 am;
    • 12,356 music plays remain without one; they are older than what Plex's history still holds.

The moods of an artist

  • Plex keeps moods and styles per artist, not per track (for example "Atmospheric, Melodic, Warm" / "Indie Folk"). It has them only in an artist's own metadata; the artist listing carries just genres and country.
  • A daily custodian job, artist_tags (no model), reads them into the Plex music index: new columns on plex_artists in lyrics.db (moods, styles, genres, country, tags_at).
    • 300 artists a run, the most tracks first; each artist again after 90 days.
  • In a sample of 100 artists from the real server, 53 had moods.
  • The index walk upserts its own columns only, so the tags survive it.

Checks

  • python tests/run_all.py is green (254/254)
  • New tests/test_plex_players.py (16 checks):
    • player_of;
    • the sync and import wiring;
    • fill_players by key and by second + title, with Spotify untouched;
    • the artist due order, tags and storage;
    • the custodian jobs;
    • the migration column.

🤖 Generated with Claude Code

Randomname653 and others added 3 commits October 25, 2026 11:55
Groundwork for the Wrap-Up's rhythm clock and "phone after midnight",
measured on the real server.

Player: every Plex history event names its device; /devices gives its
name and platform ("iPhone" / "iOS"). The sync and the history import
write player (new column) and platform for every Plex play
(plex_sync.fetch_players / player_of). A one-time custodian job,
plex_players, fills the plays already stored; most music events no longer
carry a ratingKey (the track was re-added), so a play is also found by its
second and title. On a copy of the NAS data ~19,000 music plays got their
player; 968 plays were on a phone between midnight and 5 am.

Artist moods: Plex keeps moods and styles per artist, only in an artist's
own metadata. A daily custodian job, artist_tags, reads them into the Plex
music index (plex_artists in lyrics.db: moods, styles, genres, country,
tags_at), 300 artists a run, most-played first, again after 90 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	src/database/models.py
… the arrows)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Randomname653
Randomname653 merged commit 0c8c3e9 into main Oct 25, 2026
9 of 10 checks passed
@Randomname653
Randomname653 deleted the claude/plex-player branch October 25, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant