function to sort library views by random

Bug #1447082 reported by RAWRR
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Mixxx
Fix Released
Wishlist
Joan

Bug Description

Recently, in a different music player, I discovered that auditing my huge library in a shuffled/randomized state (rather than alphabetical order, bpm, track length, etc.) was greatly helpful in finding new music to narrow down my pre-set playlist. Like probably most DJs, before a set, I create a pool of tracks to pull from during a set to avoid having to hunt through my entire library when I should be concentrating on other things. A library of thousands of tracks can be overwhelming and, frankly, difficult if not impossible to remember the entirety of.

But, when the tracks are randomized, I find it much easier to be inspired by something, and at the same time, to skip things that don't fit.

I've tried to get a similar effect by using the columns to sort by track length or bpm, which at least "shuffles" the titles/artists. This made me wonder if it might be easiest to create a column for "random" or "shuffle". This would also be an interesting solution because it would obviate the necessity for "select all". Obviously a button, like the one in autodj, would have the same advantage; however, a column would take up less space in the gui and be a little more integrated IMHO. Either would be an acceptable solution.

Currently the only way to get anything like this functionality in Mixxx is to add the entire library to autodj, then hit shuffle!! Pretty inelegant. And I wouldn't be surprised if it crashed or froze Mixxx.

Ultimately, I'd be happy if even just playlists got some version of this feature.

RAWRR (rawrr)
description: updated
Revision history for this message
Daniel Schürmann (daschuer) wrote :

Nice idea,
How about use the preview column header?

Do you have fun to implement it?

Changed in mixxx:
status: New → Confirmed
importance: Undecided → Wishlist
Revision history for this message
RAWRR (rawrr) wrote :

You mean use the preview as a kind of easter egg that when clicked causes a shuffle? That would be cool. Or label it explicitly? The latter might be confusing, having the column labeled differently than the things in it. Then again, having a dedicated shuffle column with no entries beneath it would also be a little confusing potentially.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

My original idea was actually the easter egg thing, just because we have no valid use case for the header bar button.
And the implementation is quite easy. We need just to generate random numbers for sorting key in that column.

But that is probably a private feature for you.
A dedicated column is a waste of space.

What about a context menu entry? (+ the easter egg with a tooltip)

Revision history for this message
RAWRR (rawrr) wrote :

It's only kind of an easter egg. if it was a real one we'd be keeping it secret :)

Ok. I like the preview shuffle idea. I'm not sure a context menu entry is required because typical UX design designates the context menu as being for selected items only; so unless it was a context option that only appeared when more than one item was selected, it would be out of place.

Anyway, I figure it wouldn't be possible to shuffle only a few selected tracks; things like ordering of library items probably are all-or-nothing. So it would have to be even more specific, it would have to be a context menu entry that only appeared when the entirety of tracks in a given view were selected. That would kind of fit with the easter egg theme in a cool way, but is it even possible for the context menu to have awareness of the concept of "all"?

And would the same code that drives the shuffle/random number feature in autodj be portable to the preview sorting key?

Revision history for this message
RAWRR (rawrr) wrote :

Oh - also a tooltip is a good idea for the preview column. Keeping the column named the same but hinting via tooltip seems coherent.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

We may add the context menu item to the View or Library menu.
And fix also fix Bug #1446960 by offering two or four standard sorts

The Auto DJ random sorting is probably a bit overdone for the library view, because we need not deal with duplicates and old orders.

The easter Egg version is pretty easy.
We need just to special case:
BaseSqlTableModel::setSort() and set m_tableOrderBy to ORDER BY RANDOM()

IMHO this will be a killer feature. : -) I will use it a lot honestly.

For some extra points we may sort the playing preview track on top.

Revision history for this message
RAWRR (rawrr) wrote :

View or Library seems good; whichever menu seems likely to be kept long term (remember there has been some discussion of reordering the menus: bug #1085691, bug #1228772).

But there too, it would seem relevant to make the menu context-aware. That is, unless it truly will work in every Library view. In which case, it may be a little weird to have *another* way to shuffle (meaning the button) in autodj - redundant.

So it would be a thing where it would have to appear in the menu in every active view *except* autodj, unless the shuffle code did the same thing in literally every view.

Unless, there is a way to get the menu option for shuffle to do something different depending on the Library view selected - in other words, in all views to do a simplified shuffle sort, but to activate the "overdone" shuffle sort when autodj is the active pane/view.

Idk about the playing preview on top. Maybe? yeah I guess that would be smart, in order not to suddenly lose visual track of your track, related to bug #1095287.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

> In which case, it may be a little weird to have *another* way to shuffle (meaning the button) in autodj - redundant.

Both randomize functions are completely different things, except that random() is involved. This feature we discuss her is "sort by random" feature equal to any other type of sort by .... It effects only the view. The source table is kept const.

In Auto DJ this kind of sorting is disabled to have always a reliable information which track will play next.

On the other hand we have the "Shuffle" feature, only applicable for playlists, (and AutoDJ) where the position coloum is randomized and write back to the table. It is probably not desired to use this on a well composed play-list, because it will mess up the order persistently. However there might be a demand because some media player offer this feature.

My favorite workflow for generate a random playlist is this:
* Sort a crate by random
* Drag tracks to a play list
We need to make sure that the view order becomes the play order in the new play list.
This is a pending bug.

Idea: We may add a context menu to the playlist tree node: "Clone shuffled"

Revision history for this message
Daniel Schürmann (daschuer) wrote :

I would like to change the bug title to "Sort views by random" or similar, does it match your intention?
We may need a new bug "Shuffle playlists"

RAWRR (rawrr)
summary: - function to randomize track order in playlists, crates, or entire
- library
+ function to sort library views by random
Revision history for this message
RAWRR (rawrr) wrote :

Yeah, sure, re: title change (done).

> It is probably not desired to use this on a well composed play-list, because it will mess up the order persistently.

Wait, really? That isn't how sort-by-random works in any media player I've ever used. In all those I have used, the order of tracks in the .m3u or .pls (or whatever) file only gets rewritten to the file if the user selects "save". Are you saying that Mixxx will automatically save rearrangements in a playlist file? I'm not at a machine with Mixxx atm, but I don't remember that happening. I'm hoping that isn't what happens! Maybe you're just talking about when the user creates a playlist within Mixxx but doesn't save it to a file?

As for the cloning and dragging from crates and whatnot, that seems to be getting kind of outside the original idea in terms of user complexity. It sounds like a related, but different, feature.

Anyway, I thought we were doing pretty well at the "easter egg" in preview column header (with tooltip as hint) idea. Very straightforward and clean. If the menu option complicates things, maybe we can leave that out for now.

Regarding the playlist, I don't think that playlist view will be adversely affected unless changes are automatically written to the .m3u or .pls file (I don't think they are). If the user is very concerned about altering a finely tuned playlist order, as I agree they might be, the sensible thing for them to do is duplicate the playlist before making any changes - this is pretty elementary as far as drafting any copy of anything in any medium, so people should just use common sense there.

Lastly for today, were you suggesting to employ a library (or view) menu option, and somehow to grey the option out for autodj (because it will keep it's current button that activates a different type of randomization)? Because that seems fluid and intuitive to me - either greying out the option, or having it not appear when autodj is the active view.

Revision history for this message
Daniel Schürmann (daschuer) wrote :

Thats sounds good.

Mixxx saves the result from "shuffle", but not from sorting by ...
It is all about the "#" column. If the value moves with the track -> sorting. If it sticks in the current row -> shuffle.

Revision history for this message
RAWRR (rawrr) wrote :

@dascheur: Are you working on this? Do you need anything more from me? Rereading the thread I can't tell if you left it to me to work on (it will take indefinitely longer if so).

Revision history for this message
Daniel Schürmann (daschuer) wrote :

@RAWRR: No, I do not work on this right now. (The bug is still assigned to no one)
Feel free to adopt it if you have fun. I will give you support if required.

Revision history for this message
Joan (jmigual) wrote :

Hey I think I can work with this, I will begin with the "Easter egg" option if you don't mind and then I will try to add the context menu option

Joan (jmigual)
Changed in mixxx:
assignee: nobody → Joan (j-marce-igual)
Revision history for this message
RAWRR (rawrr) wrote :

Hooray! Thanks.

Don't forget the tooltip, as <a href="https://bugs.launchpad.net/mixxx/+bug/1447082/comments/5">discussed above</a> ;)

Revision history for this message
RAWRR (rawrr) wrote :

Even though I forgot Launchpad doesn't allow html *9_9*

Revision history for this message
Daniel Schürmann (daschuer) wrote :

The Easter egg will fit to our Easter release 2.1 :-D

@Joan: do you have found the code parts of question?

Revision history for this message
Joan (jmigual) wrote :

Yes, I have created a pull request (now it's passing the checks) https://github.com/mixxxdj/mixxx/pull/908

Changed in mixxx:
status: Confirmed → Fix Committed
milestone: none → 2.1.0
Revision history for this message
RAWRR (rawrr) wrote :

I ran one of Nico Schlömer's nightlies to test this out last nigh,t and it crashed while analyzing my library, just FYI.

Revision history for this message
Daniel Schürmann (daschuer) wrote : Re: [Bug 1447082] Re: function to sort library views by random

Strange. Please provide the Mixxx.log file from the crashing run.

It would be also great if you are able to reproduce the crash during a gdb
run.
If yes, the backtrace would be very helpfull
Am 24.03.2016 9:41 nachm. schrieb "RAWRR" <email address hidden>:

> I ran one of Nico Schlömer's nightlies to test this out last nigh,t and
> it crashed while analyzing my library, just FYI.
>
> --
> You received this bug notification because you are a member of Mixxx
> Development Team, which is subscribed to Mixxx.
> https://bugs.launchpad.net/bugs/1447082
>
> Title:
> function to sort library views by random
>
> Status in Mixxx:
> Fix Committed
>
> Bug description:
> Recently, in a different music player, I discovered that auditing my
> huge library in a shuffled/randomized state (rather than alphabetical
> order, bpm, track length, etc.) was greatly helpful in finding new
> music to narrow down my pre-set playlist. Like probably most DJs,
> before a set, I create a pool of tracks to pull from during a set to
> avoid having to hunt through my entire library when I should be
> concentrating on other things. A library of thousands of tracks can be
> overwhelming and, frankly, difficult if not impossible to remember the
> entirety of.
>
> But, when the tracks are randomized, I find it much easier to be
> inspired by something, and at the same time, to skip things that don't
> fit.
>
> I've tried to get a similar effect by using the columns to sort by
> track length or bpm, which at least "shuffles" the titles/artists.
> This made me wonder if it might be easiest to create a column for
> "random" or "shuffle". This would also be an interesting solution
> because it would obviate the necessity for "select all". Obviously a
> button, like the one in autodj, would have the same advantage;
> however, a column would take up less space in the gui and be a little
> more integrated IMHO. Either would be an acceptable solution.
>
> Currently the only way to get anything like this functionality in
> Mixxx is to add the entire library to autodj, then hit shuffle!!
> Pretty inelegant. And I wouldn't be surprised if it crashed or froze
> Mixxx.
>
> Ultimately, I'd be happy if even just playlists got some version of
> this feature.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mixxx/+bug/1447082/+subscriptions
>

Revision history for this message
RAWRR (rawrr) wrote :

Here are those things. I've actually never run GDB before and wasn't sure Nico's builds were debug ones, so I didn't try any debug flags or anything. Let me know if you need something different.

Revision history for this message
RAWRR (rawrr) wrote :

Ok so I've run another of Nico's nightlies (2.1.0~20160407020002-trusty1) and here is the console output where it crashes:

mixxx: symbol lookup error: mixxx: undefined symbol: _ZNK6TagLib4MPEG4File11hasID3v2TagEv

That release also has a file labeled as dbgsym, but I don't know how to use it.

Revision history for this message
RAWRR (rawrr) wrote :

Never mind, debug symbols, figured it out 9_9

Revision history for this message
RAWRR (rawrr) wrote :

Ok, I figured it out, had to upgrade TagLib to 1.10. Was running 1.8 previously.

The random works great!!! I instantly found an awesome track I didn't even know I had ^_^!!!!

Revision history for this message
Joan (jmigual) wrote :

Oh great!

Revision history for this message
RAWRR (rawrr) wrote :

Continuing to use this, it's just incredible, better even than I thought it would be. I'm rediscovering my entire collection.

Thanks so much for doing the work on this Joan!

And thank you Daniel for helping!

Revision history for this message
RAWRR (rawrr) wrote :

Ack! Found a bug. With playlists and crates both, you can only randomize them once. After the first toggle of the preview column, it won't randomize anymore.

Library definitely allows multiple re-randomizations though.

Revision history for this message
Joan (jmigual) wrote :

Oops! when I programmed it I only changed the Library (I changed only the LibraryTableModel class because I though it was the only needing the random sort), I can also add it to playlists and crates if you want

Revision history for this message
RAWRR (rawrr) wrote :

Yeah I do think it would be ideal.

Revision history for this message
Joan (jmigual) wrote :

Ok, I've created the pull request https://github.com/mixxxdj/mixxx/pull/925

Revision history for this message
RAWRR (rawrr) wrote :

Cool!

Revision history for this message
RAWRR (rawrr) wrote :

Latest nightly shows this working great!

Changed in mixxx:
status: Fix Committed → Fix Released
Revision history for this message
Swiftb0y (swiftb0y) wrote :

Mixxx now uses GitHub for bug tracking. This bug has been migrated to:
https://github.com/mixxxdj/mixxx/issues/7976

lock status: Metadata changes locked and limited to project staff
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.