7 Commits

Author SHA1 Message Date
Deluan
ae8263671a fix: address PR review comments for playlist provider capability
Fix timer lifecycle bugs in the playlist syncer: always store
RetryInterval (including 0 to disable retries), cancel discovery timers
when RefreshInterval becomes 0, and cancel stale refresh timers when
ValidUntil becomes 0. Extract cancelRefreshTimer helper to deduplicate
the timer cleanup pattern. Improve plugin playlist update restrictions
in both the Subsonic and REST API paths to compare actual values instead
of just checking pointer presence or field inclusion, so passing
unchanged name/comment no longer triggers a false rejection.

Signed-off-by: Deluan <deluan@navidrome.org>
2026-04-12 17:38:21 -04:00
Deluan
9ddbcbf6b4 feat: persist and expose plugin playlist ValidUntil in Subsonic API
Add a ValidUntil field to the Playlist model and persist it from the
plugin's GetPlaylistResponse during sync. This allows clients to know
when a plugin playlist's data will be refreshed. The value is exposed
in the OpenSubsonic playlist response alongside the existing
smart playlist ValidUntil calculation. The migration is consolidated
into a single multi-statement ExecContext call.
2026-04-12 17:38:21 -04:00
Deluan
0a67142f74 refactor: update playlistSyncer methods to use consistent receiver naming
Signed-off-by: Deluan <deluan@navidrome.org>
2026-04-12 17:38:21 -04:00
Deluan
73203eeef0 refactor: simplify and improve playlist provider and matcher code
Eliminate redundant work and minor issues found during code review:
- Replace manual PlaylistTrack construction in syncPlaylist with the
  existing Playlist.AddMediaFiles helper, removing duplicated logic
- Pre-sanitize track fields once per artist batch in the matcher's
  fuzzy matching loop, avoiding redundant sanitization in both
  findBestMatch and computeSpecificityLevel on every iteration
- Cache resolved usernames in discoverAndSync to avoid N+1 DB lookups
  when multiple playlists share the same owner
- Use the local loadedPlugin variable instead of reading m.plugins[p.ID]
  after releasing the lock in loadPluginWithConfig
- Fix misleading uint32 comparison (<=0 to ==0) in durationProximity
- Update stale comment on checkTracksEditable to mention plugin playlists
2026-04-12 17:38:21 -04:00
Deluan
9053a4ffe9 feat(plugins): require users permission for PlaylistProvider and validate owner
PlaylistProvider capability now requires 'users' permission in the
manifest (matching existing Scrobbler behavior) and validates that the
resolved owner user ID is in the plugin's allowed users list before
creating playlists.
2026-04-12 17:38:21 -04:00
Deluan
657119fcb3 refactor(plugins): increase work channel capacity for improved playlist processing
Signed-off-by: Deluan <deluan@navidrome.org>
2026-04-12 17:38:21 -04:00
Deluan
04aa10f988 refactor(plugins): rename PlaylistGenerator to PlaylistProvider
Rename the capability from PlaylistGenerator to PlaylistProvider and the
internal orchestrator struct from playlistGeneratorOrchestrator to
playlistSyncer. The new names better describe what the capability does
(provides playlists) rather than how it works internally. All source
files, test plugin, PDK packages (Go/Rust), YAML schemas, and exported
WASM function names are updated accordingly.
2026-04-12 17:38:21 -04:00