Tentative to fix string formats if some informations are missing.
This commit is contained in:
parent
dd6431a10f
commit
0cd8704346
1 changed files with 34 additions and 26 deletions
60
empc.el
60
empc.el
|
|
@ -200,35 +200,43 @@ For status:
|
|||
|
||||
(defun empc-song-to-string (song)
|
||||
"Return a string as per `empc-playlist-song-format' variable using SONG's attributes."
|
||||
(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)))
|
||||
(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)))
|
||||
(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 (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))
|
||||
""))
|
||||
|
||||
(defun empc-mode-line-to-string ()
|
||||
"Return a string as per `empc-mode-line-format'."
|
||||
(let* ((song (empc-current-song empc-object))
|
||||
(status (empc-status empc-object))
|
||||
(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)))
|
||||
(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)))
|
||||
(if song
|
||||
(let* ((song (empc-current-song empc-object))
|
||||
(status (empc-status empc-object))
|
||||
(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 (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))
|
||||
(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 "")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue