Skip to content

Commit

Permalink
History: remove obsolete placeholder playlists
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Jan 1, 2024
1 parent 40a6055 commit 537f8f4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/library/trackset/setlogfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ SetlogFeature::SetlogFeature(
// remove unneeded entries
deleteAllUnlockedPlaylistsWithFewerTracks();

// Create empty placeholder playlist for YEAR items
QString placeholderName = "historyPlaceholder";
// remove previously created placeholder playlists
const QList<QPair<int, QString>> pls = m_playlistDao.getPlaylists(PlaylistDAO::PLHT_UNKNOWN);
for (const auto& pl : pls) {
if (pl.second.startsWith(placeholderName)) {
m_playlistDao.deletePlaylist(pl.first);
}
}

// Create empty placeholder playlist for YEAR items
m_yearNodeId = m_playlistDao.createUniquePlaylist(&placeholderName,
PlaylistDAO::PLHT_UNKNOWN);
DEBUG_ASSERT(m_yearNodeId != kInvalidPlaylistId);
Expand Down Expand Up @@ -97,8 +105,10 @@ SetlogFeature::SetlogFeature(

SetlogFeature::~SetlogFeature() {
// Clean up history when shutting down in case the track threshold changed,
// incl. the empty placeholder playlist and potentially empty current playlist
// incl. potentially empty current playlist
deleteAllUnlockedPlaylistsWithFewerTracks();
// Delete the placeholder
m_playlistDao.deletePlaylist(m_yearNodeId);
}

QVariant SetlogFeature::title() {
Expand Down

0 comments on commit 537f8f4

Please sign in to comment.