Hello, the attached patch changes a few lines to fix some problems I've encountered while setting EMMS cache from MPD.
First, "emms-player-mpd-get-alists", which converts MPD response into a list of alists, created a new record whenever it encountered a tag it has already put in the current record. Which didn't work too well in my case, for instance, "year" tags got attached to the wrong records. According to the protocol specification at https://mpd.readthedocs.io/en/latest/protocol.html#command-lsinfo, however, a new record starts with either "file", "directory" or "playlist", so I updated the function to follow that instead. Second, for some reason the "albumartist" tag wasn't processed, so I added that as well.
signature.asc
Description: PGP signature
>From fd01fa332d534da5fc93e226520fdfc34a8dffd3 Mon Sep 17 00:00:00 2001 From: SqrtMinusOne <[email protected]> Date: Mon, 2 Aug 2021 14:19:14 +0300 Subject: [PATCH] * emms-player-mpd.el: improvements in parsing MPD library Added "albumartist" to the list of imported tags. Fixed convering MPD response into a list of alists. --- emms-player-mpd.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/emms-player-mpd.el b/emms-player-mpd.el index e7a61a0..0f11a3d 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -426,7 +426,7 @@ The list will be in reverse order." cell) (dolist (line (cdr info)) (when (setq cell (emms-player-mpd-parse-line line)) - (if (assoc (car cell) alist) + (if (member (car cell) '("file" "directory" "playlist")) (setq alists (cons alist alists) alist (list cell)) (setq alist (cons cell alist))))) @@ -1128,6 +1128,7 @@ rather than EMMS." (let ((name (car data)) (value (cdr data))) (setq name (cond ((string= name "artist") 'info-artist) + ((string= name "albumartist") 'info-albumartist) ((string= name "composer") 'info-composer) ((string= name "performer") 'info-performer) ((string= name "title") 'info-title) -- 2.32.0
-- Korytov Pavel
