* mpd.el (mpd-now-playing): New.
Signed-off-by: Steve Youngs <steve@sxemacs.org>
(focus-frame cframe)
(mpd-update-variables)))
+(defun mpd-now-playing ()
+ "Return a formatted string of Title and Artist.
+
+This is for use in things like Gnus for a X-Now-Playing header etc."
+ (with-fboundp 'taglib:show-tag
+ (let ((title (and mpd-current-filename
+ (taglib:show-tag
+ (expand-file-name
+ (mpd-file) mpd-music-directory)
+ 'title)))
+ (artist (and mpd-current-filename
+ (taglib:show-tag
+ (expand-file-name
+ (mpd-file) mpd-music-directory)
+ 'artist))))
+ (format "%s --- [%s]"
+ (or title "The Sounds of Silence")
+ (or artist "Marcel Marceau")))))
(provide 'mpd)