fix: address race conditions and design issues in PlaylistGenerator

Rename PlaylistInfo.OwnerUserID to OwnerUsername so plugins provide
usernames instead of internal user IDs, with server-side resolution via
FindByUsername. Fix race condition on playlistGenerators map by using
write lock in startPlaylistGenerators and moving map access inside the
lock in unloadPlugin/Stop. Add context and WaitGroup to the orchestrator
for proper cancellation and goroutine tracking. Include owner_id in the
plugin playlist unique index. Use SetTracks instead of direct assignment
to refresh playlist duration/size/song count stats.
This commit is contained in:
Deluan 2026-03-05 09:01:33 -05:00
commit a8a336de33
10 changed files with 71 additions and 42 deletions

View file

@ -32,8 +32,8 @@ type GetPlaylistsResponse struct {
type PlaylistInfo struct {
// ID is the plugin-scoped unique identifier for this playlist.
ID string `json:"id"`
// OwnerUserID is the Navidrome user ID that owns this playlist.
OwnerUserID string `json:"ownerUserId"`
// OwnerUsername is the Navidrome username that owns this playlist.
OwnerUsername string `json:"ownerUsername"`
}
// GetPlaylistRequest is the request for GetPlaylist.

View file

@ -79,12 +79,12 @@ components:
id:
type: string
description: ID is the plugin-scoped unique identifier for this playlist.
ownerUserId:
ownerUsername:
type: string
description: OwnerUserID is the Navidrome user ID that owns this playlist.
description: OwnerUsername is the Navidrome username that owns this playlist.
required:
- id
- ownerUserId
- ownerUsername
SongRef:
description: SongRef is a reference to a song with metadata for matching.
properties: