Tentative to fix string formats if some informations are missing.

This commit is contained in:
Renaud Casenave-Péré 2011-08-27 17:40:47 +09:00
parent dd6431a10f
commit 0cd8704346

16
empc.el
View file

@ -200,20 +200,23 @@ For status:
(defun empc-song-to-string (song)
"Return a string as per `empc-playlist-song-format' variable using SONG's attributes."
(if song
(let* ((time (empc-time-to-string (plist-get song :time)))
(file (plist-get song :file))
(artist (plist-get song :artist))
(title (plist-get song :title))
(album (plist-get song :album))
(date (number-to-string (plist-get song :date)))
(date (when (plist-member song :date) (number-to-string (plist-get song :date))))
(track (plist-get song :track))
(genre (plist-get song :genre))
(pos (number-to-string (plist-get song :pos)))
(string-format `(concat ,@empc-song-format)))
(eval string-format)))
(eval string-format))
""))
(defun empc-mode-line-to-string ()
"Return a string as per `empc-mode-line-format'."
(if song
(let* ((song (empc-current-song empc-object))
(status (empc-status empc-object))
(time (empc-time-to-string (plist-get song :time)))
@ -221,14 +224,19 @@ For status:
(artist (plist-get song :artist))
(title (plist-get song :title))
(album (plist-get song :album))
(date (number-to-string (plist-get song :date)))
(date (when (plist-member song :date) (number-to-string (plist-get song :date))))
(track (plist-get song :track))
(genre (plist-get song :genre))
(pos (number-to-string (1+ (plist-get song :pos))))
(playlistlength (number-to-string (plist-get status :playlistlength)))
(state (symbol-name (plist-get status :state)))
(string-format `(concat ,@empc-mode-line-format)))
(eval string-format)))
(eval string-format))
(let* ((status (empc-status empc-object))
(state (symbol-name (plist-get status :state)))
(playlistlength (number-to-string (plist-get status :playlistlength)))
(string-format `(concat ,@empc-mode-line-format)))
(eval string-format))))
(defvar empc-last-crossfade nil)
(defvar empc-mode-line-string "")