Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library: keep hidden tracks in history #4725

Merged
merged 1 commit into from
May 6, 2022

Conversation

ronso0
Copy link
Member

@ronso0 ronso0 commented Apr 14, 2022

Remove hidden tracks from playlists but keep them in the history.

https://mixxx.zulipchat.com/#narrow/stream/109171-development/topic/Hidden.20tracks.20in.20playlists.20.2F.20crates.20.2Fhistory

Interestingly the counterpart to not remove hidden tracks when setting the History table model is already in place:

SetlogFeature::SetlogFeature(
Library* pLibrary,
UserSettingsPointer pConfig)
: BasePlaylistFeature(
pLibrary,
pConfig,
new PlaylistTableModel(
nullptr,
pLibrary->trackCollections(),
"mixxx.db.model.setlog",
/*show-all-tracks*/ true),
QStringLiteral("SETLOGHOME")),

void PlaylistTableModel::setTableModel(int playlistId) {
//qDebug() << "PlaylistTableModel::setTableModel" << playlistId;
if (m_iPlaylistId == playlistId) {
qDebug() << "Already focused on playlist " << playlistId;
return;
}
m_iPlaylistId = playlistId;
if (!m_showAll) {
// From Mixxx 2.1 we drop tracks that have been explicitly deleted
// in the library (mixxx_deleted = 0) from playlists.
// These invisible tracks, consuming a playlist position number where
// a source user of confusion in the past.
m_pTrackCollectionManager->internalCollection()->getPlaylistDAO().removeHiddenTracks(m_iPlaylistId);
}

@ronso0 ronso0 added library changelog This PR should be included in the changelog minor bug labels Apr 14, 2022
@@ -757,6 +757,10 @@ void PlaylistDAO::removeTracksFromPlaylists(const QList<TrackId>& trackIds) {
it != playlistsTrackIsInCopy.constEnd(); ++it) {
if (it.key() == trackId) {
const auto playlistId = it.value();
// keep tracks in history playlusts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function is called removeTracksFromPlaylists() without any exceptions. Now it contains some special logic in the implementation that is not mentioned anywhere. Functions should do what they are promising.

Copy link
Member Author

@ronso0 ronso0 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if it was removeTracksFromAllPlaylists() I'd fully agree.
What do you propose?
We could simply name it removeTracksFromPlaylistsExceptHistory() since we agreed to keep all tracks in history playlists, no matter if tracks are purged or hidden.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @uklotzde

@ronso0 ronso0 force-pushed the history-keep-hidden-tracks branch from ac2fdfd to 79da2d7 Compare May 1, 2022 22:26
Copy link
Contributor

@uklotzde uklotzde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hijacking playlists for storing play logs was probably not the optimal decision. Now we have to cope with that.

LGTM

@uklotzde uklotzde merged commit fa5651e into mixxxdj:2.3 May 6, 2022
@ronso0 ronso0 deleted the history-keep-hidden-tracks branch May 6, 2022 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog This PR should be included in the changelog library minor bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants