Simplify multiple field sorting using stable sort

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

Moderator: Gurus

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

Simplify multiple field sorting using stable sort

Post by pbpb » Thu Jul 09, 2020 5:37 pm

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: 47545
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Simplify multiple field sorting using stable sort

Post by Lowlander » Thu Jul 09, 2020 5:46 pm

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.
Lowlander (MediaMonkey user since 2003)

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

Re: Simplify multiple field sorting using stable sort

Post by pbpb » Thu Jul 09, 2020 7:21 pm

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: 47545
Joined: Sat Sep 06, 2003 5:53 pm
Location: MediaMonkey 5

Re: Simplify multiple field sorting using stable sort

Post by Lowlander » Thu Jul 09, 2020 9:15 pm

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.
Lowlander (MediaMonkey user since 2003)

Erwin Hanzl
Posts: 515
Joined: Tue Jun 13, 2017 8:47 am
Location: Vienna

Re: Simplify multiple field sorting using stable sort

Post by Erwin Hanzl » Sat Jul 11, 2020 1:03 am

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.29.1910 Gold-official release | Meine Einstellungen | Bilder hochladen
AutoChangeEqualizer | Clear Field 1.3 | CustomFieldsTagger 1.0.3.0 | Discogs Tagger 5.7.5
External Tools 1.4. | FindCurrentPlayingTrack 1.3.2 | Lyrics and Comment Viewer 2.2.0.0 | Randomise Playlist 1.3.
MMA 1.4.0.0932 Free Beta-Tester | Huawei Mate 20 Pro 128GB | Android H3G.AT 10.1.0.4(CT) | USB-Cable-Sync
Win 10 Vers.2004 PRO 64-Bit | Defender mit Echtzeitschutz | I7-3840 QM 2,8 GHz 4-Kern | RAM: 32 GB
Samsung-SSD on board: 840 PRO-512 GB und 860 PRO-2 TB | Extern: SSD T7-2 TB

Peke
Posts: 13276
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Simplify multiple field sorting using stable sort

Post by Peke » Sat Jul 11, 2020 6:47 pm

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

Post Reply