Skip to content

Add an option to replace the autoDJ queue with the selected tracks#1163

Merged
rryan merged 4 commits intomixxxdj:masterfrom
potocpav:djqueue
Feb 1, 2017
Merged

Add an option to replace the autoDJ queue with the selected tracks#1163
rryan merged 4 commits intomixxxdj:masterfrom
potocpav:djqueue

Conversation

@potocpav
Copy link
Copy Markdown
Contributor

Issue: https://bugs.launchpad.net/mixxx/+bug/1566206
This continues the work that started in #915.

Copy link
Copy Markdown
Contributor Author

@potocpav potocpav left a comment

Choose a reason for hiding this comment

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

Added some comments/questions to the changes

BOTTOM,
REPLACE,
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this enum defined in the right place? Should it be scoped? It leads to e.g. PlaylistDAO::AutoDJSendLoc::BOTTOM, which seems a little ugly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's fine with me -- regardless it'll be easy to move later.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, maybe it should eject the loaded, stopped track, remove it from the top of the queue, and load the new first track in the queue.

Copy link
Copy Markdown
Contributor Author

@potocpav potocpav Jan 31, 2017

Choose a reason for hiding this comment

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

Looks like a more useful variant to me

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would not touch the track, loaded on the deck. This could be an action out of sight.
Removing the top track from Auto DJ will remove the loaded track anyway if the user enables AutoDJ.

#include "library/coverart.h"
#include "library/dlgtagfetcher.h"
#include "library/libraryview.h"
#include "library/trackcollection.h"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is to pull in PlaylistDAO::AutoDJSendLoc

Comment thread src/library/dao/playlistdao.cpp Outdated

bool PlaylistDAO::clearPlaylist(const int playlistId) {
int position =
(m_pAutoDJProcessor && m_pAutoDJProcessor->nextTrackLoaded()) ? 2 : 1;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When replacing the autoDJ queue, the first track is retained if it is loaded in a deck. Is it the desired behavior?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, AutoDJProcessor relies on the currently playing track being at the top of the ADJ queue.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, though this is a general "clearPlaylist" function so it shouldn't have AutoDJ logic built in. Maybe a better name would be "removeTracksFromPlaylist(int startIndex)" and then you would pass in the appropriate start index from sendToAutoDJ as the add-to-top handling works.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, fixed.

Comment thread src/library/dao/playlistdao.cpp Outdated

bool PlaylistDAO::replaceTracksInPlaylist(const QList<TrackId>& trackIds, const int playlistId) {
return clearPlaylist(playlistId)
&& appendTracksToPlaylist(trackIds, playlistId);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the clearPlaylist fails, the appeldTracksToPlaylist is skipped (addressing the comment in the previous PR).

Comment thread src/widget/wtracktableview.cpp Outdated
sendToAutoDJ(true); // add track to Auto-DJ Queue (top)
sendToAutoDJ(PlaylistDAO::AutoDJSendLoc::TOP); // add track to Auto-DJ Queue (top)
break;
// case DlgPrefLibrary::ADD_TRACK_REPLACE:
Copy link
Copy Markdown
Member

@rryan rryan Jan 31, 2017

Choose a reason for hiding this comment

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

could you remove this comment please?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Of course.

Comment thread src/library/dao/playlistdao.cpp Outdated
}

bool PlaylistDAO::replaceTracksInPlaylist(const QList<TrackId>& trackIds, const int playlistId) {
return clearPlaylist(playlistId)
Copy link
Copy Markdown
Member

@rryan rryan Jan 31, 2017

Choose a reason for hiding this comment

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

Since this is so short and only used in one place, I would write it directly in sendToAutoDJ instead of adding a method.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, that's better.

@rryan
Copy link
Copy Markdown
Member

rryan commented Jan 31, 2017

@potocpav
Copy link
Copy Markdown
Contributor Author

@rryan yes I did, this is not my first contribution.

@rryan
Copy link
Copy Markdown
Member

rryan commented Feb 1, 2017

Thank you @potocpav -- this LGTM. I assume the Travis mac build failure is just noise.

@rryan rryan merged commit 10a1454 into mixxxdj:master Feb 1, 2017
@esbrandt esbrandt mentioned this pull request Jun 24, 2017
37 tasks
esbrandt added a commit to esbrandt/manual that referenced this pull request Jun 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants