Mic92 / python-mpd2

Python library which provides a client interface for the Music Player Daemon.
GNU Lesser General Public License v3.0
352 stars 119 forks source link

"group" keyword is not working correctly #186

Closed SoongNoonien closed 2 years ago

SoongNoonien commented 2 years ago

Hi! The "group" keyword for the list command is not working correctly when used multiple times. It will return ambiguous results which are not useful. Here is an example:

Direct output via telnet:

Trying ::1...
Connected to localhost.
Escape character is '^]'.
OK MPD 0.23.4
list album albumartist Kraftwerk group date group albumartist
AlbumArtist: Kraftwerk
Date: 1970
Album: Tone Float (Unofficial)
Date: 1974
Album: Autobahn
Album: Autobahn (2009 Der Katalog)
Date: 1975
Album: Radio-Activity
Album: Radio-Activity (2009 Der Katalog)
Album: Radio-Aktivität
Album: Radio-Aktivität (2009 Der Katalog)
Date: 1977
Album: Trans Europa Express
Album: Trans Europa Express (2009 Der Katalog)
Album: Trans Europe Express (2009 Der Katalog)
Date: 1978
Album: Die Mensch-Maschine
Album: Die Mensch-Maschine (2009 Der Katalog)
Album: The Man Machine (2009 Der Katalog)
Date: 1981
Album: Computer World
Album: Computer World (2009 Der Katalog)
Album: Computerwelt
Album: Computerwelt (2009 Der Katalog)
Date: 1986
Album: Electric Cafe (de)
Album: Electric Cafe (en)
Album: Techno Pop (2009 Der Katalog, English)
Album: Techno Pop (2009 Der Katalog, deutsch)
Date: 1991
Album: Die Roboter
Album: The Mix (2009 Der Katalog, English)
Album: The Mix (2009 Der Katalog, deutsch)
Album: The Mix (de)
Album: The Mix (en)
Date: 2003
Album: Tour De France (2009 Der Katalog)
Album: Tour De France Soundtracks
Date: 2005
Album: Minimum-Maximum
OK

python-mpd2's output:

Python 3.9.9 (main, Nov 28 2021, 10:57:04) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpd import MPDClient
>>> c=MPDClient()
>>> c.connect("localhost", 6600)
>>> c.list("album", "albumartist", "Kraftwerk", "group", "date", "group", "albumartist")
[{'albumartist': 'Kraftwerk', 'date': ['1970', '1974', '1975', '1977', '1978', '1981', '1986', '1991', '2003', '2005'], 'album': ['Tone Float (Unofficial)', 'Autobahn', 'Autobahn (2009 Der Katalog)', 'Radio-Activity', 'Radio-Activity (2009 Der Katalog)', 'Radio-Aktivität', 'Radio-Aktivität (2009 Der Katalog)', 'Trans Europa Express', 'Trans Europa Express (2009 Der Katalog)', 'Trans Europe Express (2009 Der Katalog)', 'Die Mensch-Maschine', 'Die Mensch-Maschine (2009 Der Katalog)', 'The Man Machine (2009 Der Katalog)', 'Computer World', 'Computer World (2009 Der Katalog)', 'Computerwelt', 'Computerwelt (2009 Der Katalog)', 'Electric Cafe (de)', 'Electric Cafe (en)', 'Techno Pop (2009 Der Katalog, English)', 'Techno Pop (2009 Der Katalog, deutsch)', 'Die Roboter', 'The Mix (2009 Der Katalog, English)', 'The Mix (2009 Der Katalog, deutsch)', 'The Mix (de)', 'The Mix (en)', 'Tour De France (2009 Der Katalog)', 'Tour De France Soundtracks', 'Minimum-Maximum']}]
>>> 

The problem is that I'm unable to match the entries from date with those of album while their relation is perfectly clear from the output of MPD. (I used the additional "albumartist" filter only to shorten the list a bit.) I already have a fix for the problem and will open a pull request but it think it is still appropriate to open an issue first.

SoongNoonien commented 2 years ago

Oh, I forgot this was still open.