Skip to content

Commit 6605e4d

Browse files
authored
Merge pull request #13579 from ronso0/history-purge-cleanup
(fix) History: remove purged tracks, auto-remove empty playlists
2 parents f4aec4d + 56cf7c8 commit 6605e4d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/library/dao/playlistdao.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,8 @@ void PlaylistDAO::removeTracksFromPlaylists(const QList<TrackId>& trackIds, bool
956956
++it) {
957957
if (it.key() == trackId) {
958958
const auto playlistId = it.value();
959-
// keep tracks in history playlists
960-
if (getHiddenType(playlistId) == PlaylistDAO::PLHT_SET_LOG) {
959+
// keep hidden tracks in history playlists, remove purged tracks
960+
if (!purged && getHiddenType(playlistId) == PlaylistDAO::PLHT_SET_LOG) {
961961
continue;
962962
}
963963
removeTracksFromPlaylistByIdInner(playlistId, trackId);
@@ -967,6 +967,9 @@ void PlaylistDAO::removeTracksFromPlaylists(const QList<TrackId>& trackIds, bool
967967
}
968968
transaction.commit();
969969

970+
// We may now have empty history playlists. Remove them.
971+
deleteAllUnlockedPlaylistsWithFewerTracks(PlaylistDAO::PLHT_SET_LOG, 1);
972+
970973
// update the sidebar
971974
emit playlistContentChanged(playlistIds);
972975
// If this is called by TrackCollection::purgeTracks() it will call

0 commit comments

Comments
 (0)