Sort order

As a long time music enthusiast and former database developer, I have a very keen interest in ensuring my (1,500 album) music collection is correctly sorted when displayed on screen. Since before Apple bought and renamed it, I’ve been using iTunes for this and its ability to sort how I want is exemplary. But it has other issues that mean I am looking to Plex as an alternative and I could do with some help understanding how it works in this regard.

My requirements are simple but rigorous. I like to drill down through Artist -> Album -> Track, well mostly I stop at Album and play that, but I want them listed in what I consider to be the only acceptable sort order:-

Artists should be listed sorted by what I consider to be correct for the artist, e.g. “Edmunds, Dave”, or “Dire Straits”, or “Beatles, The” etc. I have made extensive use of the Sort Artist tags to achieve this in iTunes.

Albums for an Artist should be sorted chronologically. Again, I use the Sort Album tag to achieve this.

Tracks of an album should be sorted by Disc No, then Track No.

But it gets more complicated for broader groupings:-

All albums should be sorted by Sort Artist/Sort Album

Tracks of an Artist should be sorted by Sort Album/Disc No./Track No.

And of course ‘Compilations’ should be listed separately.

The point is that iTunes can sort anything any which way, as long as you correctly tag everything, which I have done. However, what about Plex?

From some screen shots, it looks like Plex understands the ‘Sort’ tags. But:

  • Does it use them when sorting?
  • Will it actually import them when I add my correctly tagged music files (Copy from iTunes is an option is it not)?
  • Will it allow me to sort the lists as I require?

I don’t mind having to configure how it sorts, but since as far as I can tell, Plex imports all the tag metadata into a SQL database, sorting any displayed lists is simply a case of using the appropriate column names in the SQL SELECT statement. IOW, VERY easy to choose and change the sort order of the data retrieved. But can I do this? Can I specify the sort order (i.e. columns(s) I want it to use, or am I stuck with whatever has been predetermined by the developers which I am cynical enough to suspect will undoubtedly be wrong as I’ve never come across one yet who really understood about music data.

Having said that, I realise that not everyone is as concerned as I am and some will require a different order. So my question is, how configurable is Plex? Does it allow the user (administrator) to ensure the required sort order is displayed so everyone can be happy, or does it ignore this altogether and expect us to be grateful for whatever sort order the developers chose?

Although iTunes gives complete control of this to the user, Apple then totally screws it all up with all its different devices. Almost every device onto which you can place/play your music is different. An iPod Classic will sort one way, an iPhone will sort a different way etc. It is truly mind blowing that a company which placed so much importance on the concept of consistency so comprehensively ignores any such value in so many of their current products. Hence my desire to look at Plex (again). But can it do what I need? Can it?

The SortArtist and SortAlbum meta tags are imported and used. Just make sure the SortArtist tag is present in the first file of an Artist Plex ‘sees’.

Plex is very Album-centric. This means that the primary Artist tag it uses is the AlbumArtist.

Within an Artist view, the albums are sorted in reversed relase date order i.e. the latest albums appear first.
‘Various Artists’ is the ‘AlbumArtist’ for sampler albums. Albums within this Artist are simply sorted alphabetically.

To achieve proper support for multi-disc albums, it is absolutely necessary to have the AlbumTitle tag identically in all files of an album. Things like disc 1 don’t belong in the AlbumTitle tag! There is a separate Disc# tag for this.

see https://forums.plex.tv/discussion/comment/1050849/#Comment_1050849

Your embedded tags must be perfect before you add these files into Plex. Only correcting them after something goes wrong, will result in a lot of Plex Dance’ing (step 4 can be omitted with music)

If done right, it’ll look like this. I guess that’s what you’re after?

Yes that’s pretty much it for viewing an album. Where most fall down is when displaying a list of all of an artist’s tracks. I often want to play everything by a chosen artist and I want them sorted by Album/Disc/TrackNo. The sort order for the album using the Sort Album Tag of course.

My tags are all correct and using the correct tags for the data. I don’t have anything in the Title except, er, the Title.

I am concerned that the first file it imports needs the SortArtist tag present to presumably work then for all the others. Do you mean the tag must exist or must contain some data? In iTunes many of the Sort Artist tags are created automatically by iTunes but I’m not sure that is written back to the file. Any Sort Artist data I add is written back, but I cannot guarantee the first file Plex imports will have anything in that Sort Artist tag. Would it not see the empty tag?

Sorting albums in reverse order is utterly incomprehensible to me and I cannot imagine wanting to listen that way. But that’s me. Is there no way to change this. Surely it must be obvious to the developers that this is a very personal thing and cannot be fixed so no-one can change it. Is there no way to correct this?

You say Plex is ‘album centric’ which is great to hear. It is how I think about and deal with music. So I use Album Artist when it needs to be different from the Artist tag. Then I can tell iTunes to use Album Artist in preference which all works as it should.

Are you saying Plex ignores the Compilation tag and only uses Various Artists? This would not be a good thing. I know exactly what a compilation is and an Artist tag of Various Artists can be used differently for finer grained control. I’ve not come across any system that can handle an Album essentially by one artist, but with different artists on each track (e.g. last 2 by Jean Michel Jarre). Certainly not a compilation, but how can one have multiple artists on each track and that don’t then get entered as separate artists in the main artists list.

Can Plex handle multiple artists for a track? In fact, does it store a real record in the database for the album so the Album can have data associated with it and then each track can have its own data? Anywhere I can have a look at the table structure?

Would I be correct in thinking that Plex does not write tag data back to the music files? It is read when importing, but then any changes are just within the database and files are untouched? That would suit as I could continue to use iTunes to tag etc, but then Plex to share that same content out to the network clients.

@UKenGB said:
Do you mean the tag must exist or must contain some data? Would it not see the empty tag?

An empty tag is a non-existant tag. Then it’d fall back on the AlbumArtist for sorting.
So I’d make sure the album I add first has indeed the sort Artist tag present in the files.
Use a tag editor software.

Sorting albums in reverse order is utterly incomprehensible to me and …Is there no way to correct this?

Not currently.

You say Plex is ‘album centric’ which is great to hear. It is how I think about and deal with music. So I use Album Artist when it needs to be different from the Artist tag.

While this works usually, I recommend to set the AlbumArtist tags always.

Are you saying Plex ignores the Compilation tag and only uses Various Artists?

The compilation tag is an iTunes speciality.
Plex determines whether some files belong into the same album by comparing AlbumTitle and AlbumArtist, together with the folder on disk. If all three are identical, the files go into the same album.

This would not be a good thing. I know exactly what a compilation is and an Artist tag of Various Artists can be used differently for finer grained control. I’ve not come across any system that can handle an Album essentially by one artist, but with different artists on each track (e.g. last 2 by Jean Michel Jarre). Certainly not a compilation, but how can one have multiple artists on each track and that don’t then get entered as separate artists in the main artists list.

This is the difference between the AlbumArtist and the TrackArtist. Only AlbumArtists appear in the overall Artist list. TrackArtists only appear when you look at the album or use the search function.

Here is a Best Of album where the AlbumArtist is ‘Eric Clapton’ but the album contains also tracks which were recorded by the groups ‘Cream’ and ‘Derek and the Dominos’. These are stored in the TrackArtist tags of the tracks where they apply. ‘Cream’ doesn’t appear in my overall Artist list. Though I can find the tracks of ‘Cream’ when I use the search feature.

Can Plex handle multiple artists for a track?

No. Only one artist record per track.

In fact, does it store a real record in the database for the album so the Album can have data associated with it and then each track can have its own data? Anywhere I can have a look at the table structure?

I have not a good knowledge of the DB structure of Plex. If you want, you can take a look at it with a SQLite db editor (there is even one as a plugin for the Firefox web browser).
You’ll find the main db file like this: https://support.plex.tv/hc/en-us/articles/202485658-Restore-a-Database-Backed-Up-via-Scheduled-Tasks-

Would I be correct in thinking that Plex does not write tag data back to the music files? It is read when importing, but then any changes are just within the database and files are untouched?

Precisely.
But it also won’t pick up most changes to the embedded tags you do after the files have been read by Plex the first time.

@OttoKerner said:

@UKenGB said:

Sorting albums in reverse order is utterly incomprehensible to me and …Is there no way to correct this?

Not currently.

Yes there is. Take a look at this Help page.

@beckfield said:
Yes there is. Take a look at this Help page.

Ha! Yeah, I completely forgot about his one. :-"

@OttoKerner said:
The SortArtist and SortAlbum meta tags are imported and used. Just make sure the SortArtist tag is present in the first file of an Artist Plex ‘sees’.
I tested this recently with an album.

I used the album ‘Strong Persuader’ by Robert Cray. Previously, the SortArtist field has been empty. I populated the SortArtist field with ‘Cray, Robert’ (without quotes), and Plex Danced the album. The artist showed up in Plex alphabetized under ‘R,’ not ‘C.’ There may be a bug here, but I haven’t had time to make more attempts.

@OttoKerner said:
Ha! Yeah, I completely forgot about his one. :-"
We won’t hold it against you. You’re right more often than not. :wink:

@beckfield said:
I used the album ‘Strong Persuader’ by Robert Cray. Previously, the SortArtist field has been empty. I populated the SortArtist field with ‘Cray, Robert’ (without quotes), and Plex Danced the album. The artist showed up in Plex alphabetized under ‘R,’ not ‘C.’

You may have to PlexDance the Artist, not just one album.

@OttoKerner said:

@beckfield said:
I used the album ‘Strong Persuader’ by Robert Cray. Previously, the SortArtist field has been empty. I populated the SortArtist field with ‘Cray, Robert’ (without quotes), and Plex Danced the album. The artist showed up in Plex alphabetized under ‘R,’ not ‘C.’

You may have to PlexDance the Artist, not just one album.

It’s the only album I have for him, so… done! Don’t mean to hijack this thread, though.

@beckfield said:
It’s the only album I have for him, so… done!

guess1: I guess the AlbumArtist record is not really deleted when the only album of an Artist is ‘danced’.

guess2: It may also depend on the file type. I know the SortArtist is read from mp3 files. Which file did you test with?

.flac, baby. (Ignore the ‘baby.’ I needed 5 more characters) :slight_smile:

@beckfield said:
.flac, baby. (Ignore the ‘baby.’ I needed 5 more characters) :slight_smile:

=))

Confirmed for FLAC files. SortAlbum is also not imported, btw.
Will file a bug report.

Thanks for all this guys. Helping me enormously to understand how Plex deals with music data.

You say ‘Compilations’ is an iTunes thing, but it’s a real tag and there’s no reason why Plex couldn’t use it. Mind you, it was introduced before there was any such thing as Album Artist, so maybe I can do without it.

As I said, all my tagging is correct and since it’s all done in iTunes, the media files are stored in a strict directory and naming structure which I believe Plex can work with. My idea is to continue to run both concurrently at least at first.

What about singles, i.e. that have no album. How would Plex deal with those?

Seems to me that there should be a priority for tags to use, dropping back to lower priority tags if higher priority ones don’t exist. So if there’s an Album Artist, use that, if not use the Artist. If there’s a Sort version of a tag, use that to Sort, otherwise use the normal tag. E.g. if Sort Artist exists, use that to sort and if not use the value in the Artist tag. Likewise for Album and Album Artist tags. I could write the SQL to do that, but I don’t know how Plex handles this. It shouldn’t be important whether the imported media files have the higher priority tags filled in. Plex should deal with it correctly as indicated above. From a database developers viewpoint, it is BAD form to duplicate data and the ‘import’ routine should be suitably coded to avoid the need for any such duplicated data. As indeed iTunes seems to do in general usage and doesn’t duplicate tags unnecessarily.

Regarding importing while ensuring the first one has a Sort tag, what do you mean by the first one? Do you mean the first file it would find in any one import session, or the first file it imports EVER and once that is done, every subsequent import (however many sessions) will follow the same procedure, as it decided on when importing that first file?

I currently have all the media in iTunes and I was planning on simply pointing Plex at those Media folders to scan and import everything they find. So kinda tricky to ensure which would be the very first file it scanned to import. Are there no configuration options to say 'Always use Album Artist if it exists (just Artist if not) and likewise for the Sort tags. Use them if they exist and revert to the normal tags if not?

Another quick question:-

Will ALL versions of Plex client (web, iOS etc) follow the same rules for sorting? So whatever I am able to configure will apply however I view my music, from whatever device?

@UKenGB said:
Mind you, it was introduced before there was any such thing as Album Artist, so maybe I can do without it.

I doubt that. AlbumArtist existed before there even was iTunes.

What about singles, i.e. that have no album. How would Plex deal with those?

They appear in an album named [Unknown Album]

the first file it imports EVER and once that is done, every subsequent import (however many sessions) will follow the same procedure, as it decided on when importing that first file?

This is my understanding, at least when we talk about the ArtistSort.

Are there no configuration options to say 'Always use Album Artist if it exists (just Artist if not) and likewise for the Sort tags. Use them if they exist and revert to the normal tags if not?

It is currently done this way with mp3 files.
The ‘Sort’ tags are not imported from Flac files at the moment, as we determined above.

@UKenGB said:
Will ALL versions of Plex client (web, iOS etc) follow the same rules for sorting? So whatever I am able to configure will apply however I view my music, from whatever device?

The offical Plex clients will initially take the sorting order from the server. You can override this on each client individually.
I cannot guarantee this for inofficial/3rd party clients. Especially those which are not Plex clients, but are just DLNA-clients.

@OttoKerner said:

@UKenGB said:
Mind you, it was introduced before there was any such thing as Album Artist, so maybe I can do without it.

I doubt that. AlbumArtist existed before there even was iTunes.

Well for sure iTunes did not include Album Artist initially. I never saw that tag in any music files I was messing around with then either, but I guess it could have existed then. I was fairly sure it was a later introduction to tagging, but I could be wrong.

the first file it imports EVER and once that is done, every subsequent import (however many sessions) will follow the same procedure, as it decided on when importing that first file?

This is my understanding, at least when we talk about the ArtistSort.

Ah, not so bad then. Seems a bit of a daft way to do it, but I could import one single file with everything filled in, then just run the rest in after that and everything should be hunky dory :slight_smile:

Are there no configuration options to say 'Always use Album Artist if it exists (just Artist if not) and likewise for the Sort tags. Use them if they exist and revert to the normal tags if not?

It is currently done this way with mp3 files.
The ‘Sort’ tags are not imported from Flac files at the moment, as we determined above.

My music files are all MP3 or AAC. I’ll look into filling in empty Album Artist with Artist. Except singles, for which I guess it’s unnecessary.

Why no conduct a test?
Take one mp3 album and one AAC album. Copy them into a separate folder. Then create a music library in Plex and point Plex to this ‘test’ folder, instead to your main music folder.
See what happens and which metatags make it into your Plex library.

Agreed. I think I’m at the ‘go ahead and test’ stage.

Thanks for your help.