Skip to content

Commit

Permalink
Merge pull request mixxxdj#13579 from ronso0/history-purge-cleanup
Browse files Browse the repository at this point in the history
(fix) History: remove purged tracks, auto-remove empty playlists
  • Loading branch information
daschuer authored Aug 18, 2024
2 parents f4aec4d + 56cf7c8 commit 6605e4d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/library/dao/playlistdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -956,8 +956,8 @@ void PlaylistDAO::removeTracksFromPlaylists(const QList<TrackId>& trackIds, bool
++it) {
if (it.key() == trackId) {
const auto playlistId = it.value();
// keep tracks in history playlists
if (getHiddenType(playlistId) == PlaylistDAO::PLHT_SET_LOG) {
// keep hidden tracks in history playlists, remove purged tracks
if (!purged && getHiddenType(playlistId) == PlaylistDAO::PLHT_SET_LOG) {
continue;
}
removeTracksFromPlaylistByIdInner(playlistId, trackId);
Expand All @@ -967,6 +967,9 @@ void PlaylistDAO::removeTracksFromPlaylists(const QList<TrackId>& trackIds, bool
}
transaction.commit();

// We may now have empty history playlists. Remove them.
deleteAllUnlockedPlaylistsWithFewerTracks(PlaylistDAO::PLHT_SET_LOG, 1);

// update the sidebar
emit playlistContentChanged(playlistIds);
// If this is called by TrackCollection::purgeTracks() it will call
Expand Down

0 comments on commit 6605e4d

Please sign in to comment.