emms-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emms-patches] [COMMIT] Implement filtering of track data after retrievi


From: Michael Olson
Subject: [Emms-patches] [COMMIT] Implement filtering of track data after retrieving it.
Date: Thu, 7 Aug 2008 23:17:55 -0700

* lisp/emms.el (emms-track-info-filters): New option that allows the user
  to specify some functions that filter track data.  One example of this
  is removing cruft like "(Album Version)" from music purchased over
  Amazon without having to edit every single music file.
  (emms-track-updated-functions): Update docstring to indicate that this
  is called after display of the track, not before.
  (emms-track-updated): Call emms-track-info-filters.

* lisp/emms-player-mpd.el (emms-player-mpd-get-tracks-1)
  (emms-player-mpd-show-1): Call emms-track-info-filters.
---
 lisp/emms-player-mpd.el |    2 ++
 lisp/emms.el            |   11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lisp/emms-player-mpd.el b/lisp/emms-player-mpd.el
index 98d44d0..7efe13f 100644
--- a/lisp/emms-player-mpd.el
+++ b/lisp/emms-player-mpd.el
@@ -430,6 +430,7 @@ The list will be in reverse order."
                            'file))
                    (track (emms-track type file)))
               (emms-info-mpd track song-info)
+              (run-hook-with-args 'emms-track-info-filters track)
               (setq tracks (cons track tracks)))))))
     (funcall (car closure) (cdr closure) tracks)))
 
@@ -1052,6 +1053,7 @@ positive or negative."
               (emms-track-set track 'type 'file))
             (emms-track-set track 'name file)
             (emms-info-mpd track info)
+            (run-hook-with-args 'emms-track-info-filters track)
             (setq track-desc (emms-track-description track))
             (when (and (stringp track-desc) (not (string= track-desc "")))
               (setq desc (if desc
diff --git a/lisp/emms.el b/lisp/emms.el
index 100e9e8..1d8e827 100644
--- a/lisp/emms.el
+++ b/lisp/emms.el
@@ -176,8 +176,16 @@ This can be used to initialize tracks with various info."
   :group 'emms
   :type 'hook)
 
+(defcustom emms-track-info-filters nil
+  "*List of functions to call when a track changes data, before updating
+the display.
+These functions are passed the track as an argument."
+  :group 'emms
+  :type 'hook)
+
 (defcustom emms-track-updated-functions nil
-  "*List of functions to call when a track changes data.
+  "*List of functions to call when a track changes data, after updating
+the display.
 These functions are passed the track as an argument."
   :group 'emms
   :type 'hook)
@@ -588,6 +596,7 @@ a description into a playlist buffer."
 
 (defun emms-track-updated (track)
   "Information in TRACK got updated."
+  (run-hook-with-args 'emms-track-info-filters track)
   (emms-playlist-track-updated track)
   (run-hook-with-args 'emms-track-updated-functions track))
 
-- 
debian.1.5.6.1.19.ge6b2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]