Simplify multiple field sorting using stable sort

Any ideas about how to improve MediaMonkey for Windows 4? Let us know!

Moderator: Gurus

pbpb
Posts: 36
Joined: Tue Jun 09, 2020 11:09 am

Simplify multiple field sorting using stable sort

Post by pbpb »

For MMW 4.

I just discovered that to sort the item listing by artist and then by title, one first searches by title, then ctrl-search by artist. If the sort algorithm were a stable sort, the ctrl would not be needed to do something special. In fact, there is no reason I can think of where you want the previous sort to become jumbled randomly, other than shuffle playing. https://en.wikipedia.org/wiki/Sorting_a ... #Stability
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Simplify multiple field sorting using stable sort

Post by Lowlander »

I don't follow.

Are you proposing that when you sort on Title it should then automatically sort on Title > Artist?

If you just click on a column header for sort it changes sort to that column, thus to be able sort on multiple columns you need to hold down the Ctrl key for multiple column sorting. If you didn't it would now sort on that column.
pbpb
Posts: 36
Joined: Tue Jun 09, 2020 11:09 am

Re: Simplify multiple field sorting using stable sort

Post by pbpb »

No, I am not proposing that.

Rather, suppose that I want to sort by Artist, but I also want the files sorted by Title within that (and each) artist. Then currently as I understand it, if I first sort by Title, and then ctrl-sort by Artist, I will achieve the desired result. That's what you are telling me to do. I know that.

Also currently, if I first sort by Title, then sort by Artist, the titles will end up in random order. (Ok, it's not random, it just looks random.)

What I am proposing is that the second method, which currently does not produce the desired result (sort by title, then sort by artist), would produce the same result as the first (correct) method, if the sort algorithm were a stable sort, i.e. the relative order produced in sort by title would be preserved after the subsequent sort by artist.

That does, however, require that the second sort be performed on the result of the first sort, which might incur additional overhead. It may well be that the particular algorithm being used is stable, but is applied each time to the same starting state. The link I provided has a list of sort algorithms indicating which are stable and which aren't. If I recall correctly, the old old mp3collectorz windows app did use a stable sort and had the behavior I am suggesting.

I mentioned Title and Artist only because that was the thing I wanted to do today. My suggestion would apply to any fields, and in any number, as long as done in the right order.
Lowlander
Posts: 56465
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Simplify multiple field sorting using stable sort

Post by Lowlander »

I still don't follow as it seems that sort on Artist then Ctrl sort on Title gets the other result you're looking for.

Several sorts already have a pre-defined multi-sort, like sort on Album will sort Album > Album Artist > Disc# > Track#. I'm not sure what if any secondary sort is automatically applied on Title as I didn't seem to be able to detect one. Title > Album Artist > Album > Disc# > Track# would seem a logical choice here, but you can also argue that Title > Artist > Album > Album Artist > Disc# > Track# would be better.
Erwin Hanzl
Posts: 1189
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Simplify multiple field sorting using stable sort

Post by Erwin Hanzl »

Sorry, but I want to help.

Also my entry in Tools> Options> Library .. Appearance ... Ignore prefixes when sorting by Artist: "the, die"
affects the alphapetic order.

There is a good reason for this. For example:
1. Music file has the artist: The Beatles
2. Music file has the artist: Beatles
both sorted under the letter "B".
Advantage: I immediately recognize the need to change the artist tag for one of the two music files.
I just discovered that to sort the item listing by artist and then by title, one first searches by title, then ctrl-search by artist.
The order of the column markers is important!!!
The answer to the correct order of column marking can already be found in the question.
You want "listing by artist and then by title"

1. Press the column heading: Artist
2. Hold down the Ctrl key and
3. Then press on the column heading: Title

MM gives you all the freedom to sort your collection as you wish.
That's it.
MMW 4.1.31.1919 Gold-Standardinstallation
Peke
Posts: 17446
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: Simplify multiple field sorting using stable sort

Post by Peke »

Hi,
FYI MM5 builds up on that and shows Sort Orders with small numbers inside column headers.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
Post Reply