diff options
author | Rasmus <rasmus@gmx.us> | 2014-07-29 15:31:06 +0200 |
---|---|---|
committer | rasmus <rasmus@gmx.us> | 2015-03-08 20:58:01 +0100 |
commit | d12e1dc2cfd8773c8c7bfb207e2fbcaad9d674a5 (patch) | |
tree | a1259039d477eb90e5884f79a91d3ae81a6097b1 /lisp | |
parent | 3f3dc1058db5f7accbc06e80e9ad329aec2ef434 (diff) |
emms-info libtag.el: Easier to add new extension
* emms-print-metadata.c (main): Better error message.
* emms-info-libtag.el
(emms-info-libtag): New group.
(emms-info-libtag-program-name): Change to defcustom.
(emms-info-libtag-known-extensions): New variable.
(emms-info-libtag): Use emms-info-libtag-known-extensions.
Two changes: First, emms-info-libtag tells the user that it may work
with other forms. Since emms-info-libtag-known-extensions is now a
regexp variable so users can easily add new extensions, if needed.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-info-libtag.el | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/lisp/emms-info-libtag.el b/lisp/emms-info-libtag.el index ae416ff..7954ab2 100644 --- a/lisp/emms-info-libtag.el +++ b/lisp/emms-info-libtag.el @@ -43,18 +43,52 @@ ;; (setq emms-info-functions '(emms-info-libtag)) +;; You may have to compile the program from source. +;; Make sure that you have libtag installed. +;; In the EMMS source directory do +;; +;; make emms-print-metadata +;; +;; and copy src/emms-print-metadata to your PATH. + +;; If compilation fails and libtag is installed, you may have to +;; change the line +;; +;; #include <tag_c.h> +;; +;; to the correction location, e.g. +;; +;; #include <taglib/tag_c.h> + ;;; Code: (require 'emms-info) +(defgroup emms-info-libtag nil + "Options for EMMS." + :group 'emms-info) + (defvar emms-info-libtag-coding-system 'utf-8) -(defvar emms-info-libtag-program-name "emms-print-metadata") + +(defcustom emms-info-libtag-program-name "emms-print-metadata" + "Name of emms-info-libtag program." + :type '(string) + :group 'emms-info-libtag) + +(defcustom emms-info-libtag-known-extensions + (regexp-opt '("mp3" "mp4" "m4a" "ogg" "flac" "spx" "wma")) + "Regexp of known extensions compatible with `emms-info-libtag-program-name'. + +Case is irrelevant." + :type '(string) + :group 'emms-info-libtag) (defun emms-info-libtag (track) (when (and (eq 'file (emms-track-type track)) - (string-match - "\\.\\([Mm][Pp][34]\\|[Mm]4[aA]\\|[oO][gG][gG]\\|[fF][lL][aA][cC]\\|[sS][pP][xX]\\)\\'" - (emms-track-name track))) + (let ((case-fold-search t)) + (string-match + emms-info-libtag-known-extensions + (emms-track-name track)))) (with-temp-buffer (when (zerop (let ((coding-system-for-read 'utf-8)) |