Optimize playlist cover generation

This commit is contained in:
Deluan 2023-01-13 21:33:49 -05:00 committed by Deluan Quintão
parent c46a2a5f5f
commit 16c869ec86
5 changed files with 42 additions and 28 deletions

View file

@ -205,7 +205,7 @@ func (s *playlists) Update(ctx context.Context, playlistID string,
pls.AddTracks(idsToAdd)
} else {
if len(idsToAdd) > 0 {
_, err = repo.Tracks(playlistID).Add(idsToAdd)
_, err = repo.Tracks(playlistID, true).Add(idsToAdd)
if err != nil {
return err
}
@ -232,7 +232,7 @@ func (s *playlists) Update(ctx context.Context, playlistID string,
}
// Special case: The playlist is now empty
if len(idxToRemove) > 0 && len(pls.Tracks) == 0 {
if err = repo.Tracks(playlistID).DeleteAll(); err != nil {
if err = repo.Tracks(playlistID, true).DeleteAll(); err != nil {
return err
}
}