diff options
author | yonirabkin <yonirabkin> | 2005-09-23 21:30:00 +0000 |
---|---|---|
committer | yonirabkin <mwolson@gnu.org> | 2005-09-23 21:30:00 +0000 |
commit | 244fb3fa97e40c6a16885a109b660af093693d22 (patch) | |
tree | e60274c3109c763e959d09dcf5d1e9eb5b280b66 | |
parent | 66d6f60c1a4fa48d83ee33f1c5c9e4293f72d181 (diff) |
Adding emms-info-ogginfo.el and consiquently modifying emms-default
darcs-hash:20050923213008-be80e-471fff42070a012a822fdd34958b2c65c974a10e.gz
-rw-r--r-- | emms-default.el | 5 | ||||
-rw-r--r-- | emms-info-ogginfo.el | 64 | ||||
-rw-r--r-- | emms-playlist-mode.el | 5 |
3 files changed, 67 insertions, 7 deletions
diff --git a/emms-default.el b/emms-default.el index 4747a6a..7de7dde 100644 --- a/emms-default.el +++ b/emms-default.el @@ -73,9 +73,8 @@ always work, unless you get very unlucky with a CVS-build." (add-to-list 'emms-track-initialize-functions 'emms-info-initialize-track) (require 'emms-info-mp3info) (add-to-list 'emms-info-functions 'emms-info-mp3info) - (ignore-errors - (require 'emms-info-ogg) - (add-to-list 'emms-info-functions 'emms-info-ogg)) + (require 'emms-info-ogginfo) + (add-to-list 'emms-info-functions 'emms-info-ogginfo) ;; setup info (setq emms-track-description-function 'emms-info-track-description) diff --git a/emms-info-ogginfo.el b/emms-info-ogginfo.el new file mode 100644 index 0000000..14c551e --- /dev/null +++ b/emms-info-ogginfo.el @@ -0,0 +1,64 @@ +;;; emms-info-ogginfo.el --- Emms information from Ogg Vorbis files. + +;;; Copyright 2005, Yoni Rabkin under the GNU General Public License. + +;;; Commentary: +;; + +;;; Code: + +(defgroup emms-info-ogginfo nil + "An EMMS-info method for getting, using the external ogginfo +program" + :group 'emms-info) + +(defcustom emms-info-ogginfo-coding-system 'latin-1 + "*Coding system used in the output of ogginfo." + :type 'coding-system + :group 'emms-info-ogginfo) + +(defcustom emms-info-ogginfo-program-name "ogginfo" + "*The name/path of the ogginfo tag program." + :type 'string + :group 'emms-info-ogginfo) + +(defun emms-info-ogginfo (track) + "Add track information to TRACK. +This is a useful element for `emms-info-functions'." + (when (and (eq 'file (emms-track-type track)) + (string-match "\\.[Oo][Gg][Gg]\\'" (emms-track-name track))) + + (with-temp-buffer + (when (zerop + (call-process emms-info-ogginfo-program-name + nil t nil (emms-track-name track))) + + ;; play time, emms-info-ogg.el [U. Jensen] + (goto-char (point-min)) + (re-search-forward "Playback length: \\([0-9]*\\)m:\\([0-9]*\\)") + (let ((minutes (string-to-int (match-string 1))) + (seconds (string-to-int (match-string 2)))) + (setq ptime-total (+ (* minutes 60) seconds) + ptime-min minutes + ptime-sec seconds)) + (emms-track-set track 'info-playing-time ptime-total) + (emms-track-set track 'info-playing-time-min ptime-min) + (emms-track-set track 'info-playing-time-sec ptime-sec) + (emms-track-set track 'info-file (emms-track-name track)) + + ;; all the rest of the info available + (goto-char (point-min)) + (when (re-search-forward "User comments section follows..." (point-max) t) + (while (zerop (forward-line 1)) + (when (looking-at "^\t\\(.*\\)=\\(.*\\)$") + (let ((a (match-string 1)) + (b (match-string 2))) + (when (and (< 0 (length a)) + (< 0 (length b))) + (emms-track-set track + (intern (downcase (concat "info-" (match-string 1)))) + (match-string 2))))))))))) + +(provide 'emms-info-ogginfo) + +;;; emms-info-ogginfo.el ends here diff --git a/emms-playlist-mode.el b/emms-playlist-mode.el index 21aa337..440cbec 100644 --- a/emms-playlist-mode.el +++ b/emms-playlist-mode.el @@ -13,10 +13,7 @@ ;;; ;;; Feature requests: ;;; -;;; (1) Lukhas wants `emms-list-playlist-buffers' to list all the -;;; playlist buffers. -;;; -;;; (2) Arbitrary comment entry with color overlays. +;;; (1) Arbitrary comment entry with color overlays. ;;; Code: |