Fix playlist parsing.

songs informations are delimited by the `id' keyword.
songs may specify several times the same keyword (if this keyword is not :time, :track, :date, :pos or :id).
This commit is contained in:
Renaud Casenave-Péré 2011-07-20 10:25:59 +09:00
parent 853fe33bc7
commit b574ab150e

View file

@ -168,15 +168,16 @@ then update what needs to be."
(index (- (length empc-current-playlist) 1)))
(dolist (cell data)
(let ((field (intern (concat ":" (car cell)))))
(when (and song
(plist-get song field))
(when (and (eq field :id) song)
(aset empc-current-playlist index song)
(setq song nil)
(decf index))
(cond
((member field '(:time :track :date :pos :id))
(setq song (cons field (cons (string-to-int (cdr cell)) song))))
(t (setq song (cons field (cons (cdr cell) song)))))))
(plist-put song field (string-to-int (cdr cell))))
(t (if (plist-get song field)
(plist-put song field (concat (plist-get song field) ", " (cdr cell)))
(plist-put song field (cdr cell)))))))
(when (and song (>= index 0))
(aset empc-current-playlist index song))))