diff options
author | Damien Elmes <emms@repose.cx> | 2006-08-17 16:00:00 +0000 |
---|---|---|
committer | Damien Elmes <emms@repose.cx> | 2006-08-17 16:00:00 +0000 |
commit | 1100c55965f7e0c41dd1530eeb62f31635019a9d (patch) | |
tree | d109626ebbc701f87f9a28dfba252b3bd2079aa7 | |
parent | d85ede8a7d0e4bbdcc35b33fad617be513618dcb (diff) |
browser: only display '. ' if there's a valid track number
darcs-hash:20060817160007-4e3e3-dff1f93f7c5486199c6aa3116ff80ac627beaca3.gz
-rw-r--r-- | emms-browser.el | 131 |
1 files changed, 77 insertions, 54 deletions
diff --git a/emms-browser.el b/emms-browser.el index c9dc4b4..97de0f2 100644 --- a/emms-browser.el +++ b/emms-browser.el @@ -1403,62 +1403,9 @@ included." " "))) ;; -------------------------------------------------- -;; Display formats & fonts +;; Display formats ;; -------------------------------------------------- -(defvar emms-browser-default-format "%i%n" - "indent + name") - -(defvar emms-browser-info-title-format "%i%T. %n") -(defvar emms-browser-playlist-info-title-format - emms-browser-info-title-format) - -(defvar emms-browser-info-album-format - 'emms-browser-year-and-album-fmt) -(defvar emms-browser-playlist-info-album-format - 'emms-browser-year-and-album-fmt-med) - -;; FIXME: optional format strings would be nice -(defun emms-browser-year-and-album-fmt (bdata fmt) - (concat - "%i%cS" - (let ((year (emms-browser-format-elem fmt "y"))) - (if (and year (not (string= year "0"))) - "(%y) " - "")) - "%n")) - -(defun emms-browser-year-and-album-fmt-med (bdata fmt) - (concat - "%i%cM" - (let ((year (emms-browser-format-elem fmt "y"))) - (if (and year (not (string= year "0"))) - "(%y) " - "")) - "%n")) - -(defmacro emms-browser-make-face (name dark-col light-col height) - (let ((face-name (intern (concat "emms-browser-" name "-face")))) - `(defface ,face-name - '((((class color) (background dark)) - (:foreground ,dark-col - :height ,height)) - (((class color) (background light)) - (:foreground ,light-col - :height ,height)) - (((type tty) (class mono)) - (:inverse-video t)) - (t (:background ,dark-col))) - ,(concat "Face for " - name - " in a browser/playlist buffer.") - :group 'emms-browser-mode))) - -(emms-browser-make-face "year/genre" "#aaaaff" "#444477" 1.5) -(emms-browser-make-face "artist" "#aaaaff" "#444477" 1.3) -(emms-browser-make-face "album" "#aaaaff" "#444477" 1.1) -(emms-browser-make-face "track" "#aaaaff" "#444477" 1.0) - (defun emms-browser-bdata-first-track (bdata) "Return the first track from a given bdata. If > album level, most of the track data will not make sense." @@ -1609,6 +1556,82 @@ the text that it generates." (buffer-string))) ;; -------------------------------------------------- +;; Display formats - defaults +;; -------------------------------------------------- + +;; FIXME: optional format strings would avoid having to define a +;; function for specifiers which may be empty. + +(defvar emms-browser-default-format "%i%n" + "indent + name") + +;; tracks +(defvar emms-browser-info-title-format + 'emms-browser-track-artist-and-title-format) +(defvar emms-browser-playlist-info-title-format + 'emms-browser-track-artist-and-title-format) + +(defun emms-browser-track-artist-and-title-format (bdata fmt) + (concat + "%i" + (let ((track (emms-browser-format-elem fmt "T"))) + (if (and track (not (string= track "0"))) + "%T. " + "")) + "%n")) + +;; albums - we define two formats, one for a small cover (browser), +;; and one for a medium sized cover (playlist). +(defvar emms-browser-info-album-format + 'emms-browser-year-and-album-fmt) +(defvar emms-browser-playlist-info-album-format + 'emms-browser-year-and-album-fmt-med) + +(defun emms-browser-year-and-album-fmt (bdata fmt) + (concat + "%i%cS" + (let ((year (emms-browser-format-elem fmt "y"))) + (if (and year (not (string= year "0"))) + "(%y) " + "")) + "%n")) + +(defun emms-browser-year-and-album-fmt-med (bdata fmt) + (concat + "%i%cM" + (let ((year (emms-browser-format-elem fmt "y"))) + (if (and year (not (string= year "0"))) + "(%y) " + "")) + "%n")) + +;; -------------------------------------------------- +;; Display faces +;; -------------------------------------------------- + +(defmacro emms-browser-make-face (name dark-col light-col height) + (let ((face-name (intern (concat "emms-browser-" name "-face")))) + `(defface ,face-name + '((((class color) (background dark)) + (:foreground ,dark-col + :height ,height)) + (((class color) (background light)) + (:foreground ,light-col + :height ,height)) + (((type tty) (class mono)) + (:inverse-video t)) + (t (:background ,dark-col))) + ,(concat "Face for " + name + " in a browser/playlist buffer.") + :group 'emms-browser-mode))) + +(emms-browser-make-face "year/genre" "#aaaaff" "#444477" 1.5) +(emms-browser-make-face "artist" "#aaaaff" "#444477" 1.3) +(emms-browser-make-face "album" "#aaaaff" "#444477" 1.1) +(emms-browser-make-face "track" "#aaaaff" "#444477" 1.0) + +;; -------------------------------------------------- ;; Filtering ;; -------------------------------------------------- |