MinimServer Forum
How to display names (composer etc.) alphabetically in album list? - Printable Version

+- MinimServer Forum (https://forum.minimserver.com)
+-- Forum: MinimServer (/forumdisplay.php?fid=1)
+--- Forum: General (/forumdisplay.php?fid=2)
+--- Thread: How to display names (composer etc.) alphabetically in album list? (/showthread.php?tid=5799)



How to display names (composer etc.) alphabetically in album list? - Uoppi - 19-08-2020 14:18

I use AlbumArtist.displayFormat={$ComposerSort^^^ / } so that I can see all the composers by lastname, firstname that appear on the album. (The names appear next to the album cover in the album list.)

The composers are displayed in the order in which they appear on the album tracks.

Is there any way I can can get MinimServer to display them in alphabetical order?

I.e., instead of:
Hindemith, Paul / Britten, Benjamin / Doráti, Antal / Haas, Pavel / Ben-Haim, Paul
I would be able to see next to the album:
Ben-Haim, Paul / Britten, Benjamin / Doráti, Antal / Haas, Pavel / Hindemith, Paul

I can of course manually edit the Album Artist field into alphabetical order (and hence leave out the AlbumArtist.displayFormat={$ComposerSort^^^ / }) but it means HUGE amount of work. (I wish Masstagger could alphabetically correct the Album Artist field for me but I haven't been able to find a script.)


RE: How to display names (composer etc.) alphabetically in album list? - simoncn - 19-08-2020 18:42

An album doesn't have a file to which tags can be attached, so MinimServer computes "virtual" tag values for an album using the track files in the album. For tag names that have more than one value within the album, the order of these "virtual" tag values is determined by the order of tracks within the album.

When tag formatting is applied to an album, the order of the "virtual" tag values for the album is used, just as it would be for multiple "real" tag values within a single file. It is not possible to change this order.


RE: How to display names (composer etc.) alphabetically in album list? - simbun - 19-08-2020 20:23

I'm also not aware of a way you can sort the album artist field using foobar functions, but if you have a basic understanding of linux or windows scripting you could achieve what you want by using m-TAGS.

By Using m-TAGS in foobar you can create an export of each album to a text file (by default with !.tags extension) that contains all the music tags, which can be subsequently processed, loaded back into foobar and used to update your music files (it's much more powerful than that, but that's primarily what I use it for).

Example album output file:
Code:
[
   {
      "@" : "/G:/Tagged&Cleaned/flac/Beatles, The/2010 - 1962-1966 (The Red Album)/01.01.flac",
      "ALBUM" : "1962-1966 (The Red Album)",
      "ALBUM ARTIST" : "The Beatles",
      "ALBUMARTISTSORT" : "Beatles, The",
      "ARTIST" : "The Beatles",
      "ARTISTSORT" : "Beatles, The",
      "DATE" : "2010",
      "DATEADDED" : "2017-03-15",
      "DISCNUMBER" : "01",
      "GENRE" : "Pop Rock",
      "TITLE" : "Love Me Do",
      "TRACKNUMBER" : "01"
   },
   {
      "@" : "/G:/Tagged&Cleaned/flac/Beatles, The/2010 - 1962-1966 (The Red Album)/01.02.flac",
      "TITLE" : "Please Please Me",
      "TRACKNUMBER" : "02"
   },
   ...
]


So if all you need is to sort the values in Album Artist, process each text file (album) and when you get to the Album Artist line, split the values by your separator, sort them and write that line back out.
If you wanted to build a sorted string based on the Composer Sort tags across the whole album, you'd parse the file collecting all the Composer Sort tags, dedupe and sort them, then write the file back out with the modified Album Artist(SORT) string.

I used this approach for supplementing my files (~20,000 at the time) with data from a musicbrainz data dump without any issues (although a few things to beware of if you're adding new text into the file, rather than just rearranging it like you need to).


RE: How to display names (composer etc.) alphabetically in album list? - Uoppi - 21-08-2020 16:14

I ended up arranging the Album Artist field manually. It took a few hours, although it was just copy-pasting existing tag values/names into alphabetical order.


RE: How to display names (composer etc.) alphabetically in album list? - simbun - 22-08-2020 15:17

When you said that doing it manually "means HUGE amount of work" I assumed you meant that it wouldn't be feasible to do it manually, hence the M-TAGS suggestion, otherwise I would have suggested another foobar component called SQLite (foo_sqlite).
(foo_)SQLite is primarily a reporting and playlist generation tool that allows you to interrogate the internal foobar SQLite database, therefore it can't update the tags, but it could have helped you along the way (giving you the text to paste).

If all you were trying to do was to sort the album artist field you could have run:
Code:
select album,
       strsortgroup([album artist], '; ')
  from Playlist
  where playlist_name = 'Default'
  group by album

Or, if you'd wanted to collect all the composer tags for a given album, deduped and sorted them you could have run:
Code:
select album,
       strsortgroup( group_concat(composer, '; '), '; ')
  from (
    select distinct album,
           composer
      from Playlist
      where playlist_name = 'Default'
  )
  group by album

Obviously replace album in the above examples with whatever you use to uniquely identify an album e.g. 'Greatest Hits' would not be unique across all my albums.

NOTE: Composer and Composersort aren't defined within the SQLite setup by default and need to be added via 'Preferences > Media Library > SQLite viewer > Playlist table' < Add, Type:Tag, Name:composer, Collation:NaturalNoCase, Split multivalue tag (Yes) >

I suppose it could still be useful for checking your work :-)