mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-24 18:27:08 +02:00
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
This commit is contained in:
parent
9053a4ffe9
commit
73203eeef0
3 changed files with 15 additions and 20 deletions
|
|
@ -212,7 +212,7 @@ func (s *playlists) checkWritable(ctx context.Context, id string) (*model.Playli
|
|||
return pls, nil
|
||||
}
|
||||
|
||||
// checkTracksEditable verifies the user can modify tracks (ownership + not smart playlist).
|
||||
// checkTracksEditable verifies the user can modify tracks (ownership + not smart/plugin playlist).
|
||||
func (s *playlists) checkTracksEditable(ctx context.Context, playlistID string) (*model.Playlist, error) {
|
||||
pls, err := s.checkWritable(ctx, playlistID)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue