How about adding more playlist sort functions? Such as, sort by title,
artist, name, year, etc. In a word, i'd like a similar sort interface as
in `ibuffer'.
;; sort by title
(emms-sort-do (lambda (a b)
(string< (emms-track-get a 'info-title)
(emms-track-get b 'info-title))))
;; sort by artist
(emms-sort-do (lambda (a b)
(string< (emms-track-get a 'info-artist)
(emms-track-get b 'info-artist))))
(defun emms-sort-do (predicate)
"Sort the whole playlist buffer by PREDICATE."
(interactive)
(with-current-emms-playlist
(save-excursion
(emms-playlist-ensure-playlist-buffer)
(widen)
(let ((current (emms-playlist-selected-track))
(tracks (emms-playlist-tracks-in-region (point-min)
(point-max))))
(delete-region (point-min)
(point-max))
(run-hooks 'emms-playlist-cleared-hook)
(mapc 'emms-playlist-insert-track
(sort tracks predicate))
(let ((pos (text-property-any (point-min)
(point-max)
'emms-track current)))
(if pos
(emms-playlist-select pos)
(emms-playlist-first)))))))
Also, i'm trying to write sort of `(define-emms-source advanced-find
(dir attribute regex))', which allows me to find files matched by artist
or title, etc. But i met some difficulties in retrieving files' info,
since they were `later-do'. Any hints?
--
William
_______________________________________________
Emms-help mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emms-help