Format of Response to "list"

Discuss client development (or even MPD development if you feel so inclined), ask questions about the client libs, MPD feature requests from client developers, etc...
Post Reply
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Format of Response to "list"

Post by Plastic Sturgeon »

Hi,

At some point between protocol version 0.20.0 (Music Player Daemon 0.20.18) and 0.21.11 (Music Player Daemon 0.21.25), the response to a command like

Code: Select all

list Album group AlbumArtist group AlbumArtistSort group Date
changed. When originally I got

Code: Select all

OK MPD 0.20.0
list Album group AlbumArtist group AlbumArtistSort group Date
Album: 16 Walzer, op. 39
AlbumArtist: Johannes Brahms
AlbumArtist: Leon Fleisher
AlbumArtist: George Szell
AlbumArtist: The Cleveland Orchestra
AlbumArtistSort: Brahms, Johannes
AlbumArtistSort: Fleisher, Leon
AlbumArtistSort: Szell, George
AlbumArtistSort: Cleveland Orchestra, The
Date: 1956
Album: 25. Klavierkonzert C-Dur, KV 503
AlbumArtist: Wolfgang Amadeus Mozart
AlbumArtist: Leon Fleisher
AlbumArtist: George Szell
AlbumArtist: The Cleveland Orchestra
AlbumArtistSort: Mozart, Wolfgang Amadeus
AlbumArtistSort: Fleisher, Leon
AlbumArtistSort: Szell, George
AlbumArtistSort: Cleveland Orchestra, The
Date: 1959
Album: Klavierkonzert Nr. 1 C-Dur, op. 15
AlbumArtist: Ludwig van Beethoven
AlbumArtist: Leon Fleisher
AlbumArtist: George Szell
AlbumArtist: The Cleveland Orchestra
AlbumArtistSort: Beethoven, Ludwig van
AlbumArtistSort: Fleisher, Leon
AlbumArtistSort: Szell, George
AlbumArtistSort: Cleveland Orchestra, The
Date: 1961
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Johannes Brahms
AlbumArtist: Leon Fleisher
AlbumArtist: George Szell
AlbumArtist: The Cleveland Orchestra
AlbumArtistSort: Brahms, Johannes
AlbumArtistSort: Fleisher, Leon
AlbumArtistSort: Szell, George
AlbumArtistSort: Cleveland Orchestra, The
...
I now get

Code: Select all

OK MPD 0.21.11
list Album group AlbumArtist group AlbumArtistSort group Date
Date: 1956
AlbumArtistSort: Brahms, Johannes
AlbumArtist: George Szell
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Johannes Brahms
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Leon Fleisher
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: The Cleveland Orchestra
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtistSort: Cleveland Orchestra, The
AlbumArtist: George Szell
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Johannes Brahms
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Leon Fleisher
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: The Cleveland Orchestra
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtistSort: Fleisher, Leon
AlbumArtist: George Szell
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Johannes Brahms
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Leon Fleisher
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: The Cleveland Orchestra
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtistSort: Szell, George
AlbumArtist: George Szell
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Johannes Brahms
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: Leon Fleisher
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
AlbumArtist: The Cleveland Orchestra
Album: 16 Walzer, op. 39
Album: Variationen und Fuge über ein Thema von Händel op. 24
Date: 1958
AlbumArtistSort: Brahms, Johannes
AlbumArtist: George Szell
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Johannes Brahms
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Leon Fleisher
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: The Cleveland Orchestra
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtistSort: Cleveland Orchestra, The
AlbumArtist: George Szell
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Johannes Brahms
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Leon Fleisher
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: The Cleveland Orchestra
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtistSort: Fleisher, Leon
AlbumArtist: George Szell
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Johannes Brahms
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Leon Fleisher
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: The Cleveland Orchestra
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtistSort: Szell, George
AlbumArtist: George Szell
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Johannes Brahms
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: Leon Fleisher
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
AlbumArtist: The Cleveland Orchestra
Album: Klavierkonzert Nr. 1 d-Moll, op. 15
...
While I appreciate that the new format can be much more compact in some cases, it's a lot harder to handle.

Before I go and rewrite my album handling, I thought I would ask: Is there a way to configure MPD back to the old format? Alternatively, a way to send the command so that it produces the "extended" response? I did not find anything in that direction in the documentation, but I'm not giving up hope, yet ;)

Cheers,

Daniel
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

To give some context: I want to display a list of all albums, showing the title (Album), AlbumArtist and/or sort key (AlbumArtistSort), and Date information. Note that the collections I'm handling contain albums with more than one album artist (especially classical music), and distinct albums with identical names (e.g. "A Night at the Opera", which is both an album by Queen and a different one by Blind Guardian, and truckloads of "Symphony No. 1").
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Format of Response to "list"

Post by max »

The original "group" implementation was bugged; it did not work as documented, and the way it worked, it did not make any sense. Therefore, it was fixed in MPD 0.20.22 two years ago, to follow the documentation.
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

max wrote: August 31st, 2020, 7:22 am the way it worked, it did not make any sense
The way it worked was extremely useful for my application. What is the recommended way to achieve what I described in my second post?
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Format of Response to "list"

Post by max »

I have no idea how you did it previously, because as I said, the response did not make sense and did not do what was documented.

Why do you believe the "new format" is "harder to handle"?
(Note, it's not the "new format" - it's the old format, the one that has always been documented.)

What's really your difficulty with it?

I wonder why you didn't have those difficulties with the broken format. Because I have no idea what this broken output means.
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

The response I got with 0.20.0 was simply a list of all distinct albums with all the tags I listed in the groups queries. In my OP, this list starts with "16 Walzer, op. 39" by "Johannes Brahms, Leon Fleisher, George Szell, The Cleveland Orchestra" (followed by sort keys) from 1956, the next album is "25. Klavierkonzert C-Dur, KV 503" with all the requested tags, and so on. I understand that this is not what you intended, but it gave me exactly what I needed.
With a single query, I got all the data I needed.
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Format of Response to "list"

Post by max »

And how do you know which Date value belongs to which Artist?
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

max wrote: August 31st, 2020, 11:05 am And how do you know which Date value belongs to which Artist?
The date doesn't belong to an artist, it belongs to an album. Everything up to the next Album belongs to the previous one. Belonged, obviously.
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Format of Response to "list"

Post by max »

Plastic Sturgeon wrote: August 31st, 2020, 11:18 am The date doesn't belong to an artist, it belongs to an album.
I don't think that's correct. There can be multiple artists for one album because multiple artists can publish albums under the same name, and then those distinct albums have different dates.

For example, Styx have released the album "Brave New World" in 1999, and Iron Maiden released an album with the same name in 2000. Those are two different albums with very different music.

Previously, MPD would return some garbage which told you that Styx and Iron Maiden were artists for the one album "Brave New World", released in 1999 and 2000. Now you would list this one album, made by Styx AND Iron Maiden, released in 1999 or 2000, dunno... or what?

After the fix, after implementing the way it was always documented, MPD tells you there are two albums, and gives you the correct details for each.
max
Forum team
Posts: 1139
Joined: January 15th, 2013, 3:43 pm

Re: Format of Response to "list"

Post by max »

Example, old and bugged (indentation added for readability):

Code: Select all

Album: Brave New World
  Artist: Styx
  Artist: Iron Maiden
  Date: 2000
  Date: 1999
The top level is "Album" (i.e. grouped by "Album", which is contrary to what you requested), followed by a list of all artists, followed by a list of all dates. Which belongs to which? Can't possibly know, this information is lost.

Fixed (and request reordered as "list date group artist group album" to make it more useful for your use case - and indentation added for readability):

Code: Select all

Album: Brave New World
  Artist: Iron Maiden
    Date: 2000
  Artist: Styx
    Date: 1999
Top level is "Album", and on the second level, there are two artists with this album. Each of those artists has one year for that album. This is a tree with exactly the structure you requested.
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

max wrote: August 31st, 2020, 11:48 am I don't think that's correct. There can be multiple artists for one album because multiple artists can publish albums under the same name, and then those distinct albums have different dates.

For example, Styx have released the album "Brave New World" in 1999, and Iron Maiden released an album with the same name in 2000. Those are two different albums with very different music.
Yes, I mentioned similar examples in my second post above. This was not a problem with the buggy implementation because the response was:

Code: Select all

Album: A Night at the Opera
AlbumArtist: Blind Guardian
Date: 2002
Album: A Night at the Opera
AlbumArtist: Queen
Date: 1975
The response is similar in the current implementation but the order is different within the blocks. (It's possible that rearranging the group statements in the query would restore previous order.)

However, if there are multiple album artist for an identical album (as for the 16 Walzer example I provided), I get the power set of Album x AlbumArtist x AlbumArtistSort x Date, which is what you see in the response in the OP. This response will contain the same album titles multiple times if two distinct albums have the same title, or if one album has multiple albumartists/dates/albumartistsorts. With the fixed behavior, I have no way of distinguishing single albums with multiple artists from multiple distinct albums. This distinction was trivial with the buggy behavior because each distinct album was listed separately.
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

Sorry, messages crossed paths ...
max wrote: August 31st, 2020, 11:54 am Example, old and bugged (indentation added for readability):

Code: Select all

Album: Brave New World
  Artist: Styx
  Artist: Iron Maiden
  Date: 2000
  Date: 1999
That is not the behavior I'm seeing; see my previous reply.
Plastic Sturgeon
Posts: 8
Joined: August 30th, 2020, 1:58 pm

Re: Format of Response to "list"

Post by Plastic Sturgeon »

Is it sufficiently clear what I'm trying to achieve? If not, I'd be happy to provide more details. If it's clear, what do you consider the most efficient way of listing all albums with their respective AlbumArtist, AlbumArtistSort, and Date?
Post Reply