diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-player-vlc.el | 5 | ||||
-rw-r--r-- | lisp/emms-playlist-sort.el | 43 |
2 files changed, 28 insertions, 20 deletions
diff --git a/lisp/emms-player-vlc.el b/lisp/emms-player-vlc.el index 9a42434..34ddd25 100644 --- a/lisp/emms-player-vlc.el +++ b/lisp/emms-player-vlc.el @@ -45,15 +45,14 @@ ;; track, so the player sentinel has no way of telling that the next ;; track should be played. Therefore I redefine this low-level ;; function and add a "quit" track which is invisible to Emms. -(defun emms-player-vlc-start (track) - "Cause vlc to play TRACK." +(defadvice emms-player-vlc-start (around quit-vlc-after-finish activate) (let ((process (apply 'start-process emms-player-simple-process-name nil "vlc" ;; splice in params here (append '("vlc" "--intf" "rc") - (list (emms-track-name track)) + (list (emms-track-name (ad-get-arg 0))) '("vlc://quit"))))) ;; add a sentinel for signaling termination (set-process-sentinel process 'emms-player-simple-sentinel)) diff --git a/lisp/emms-playlist-sort.el b/lisp/emms-playlist-sort.el index 1b0c875..e35d483 100644 --- a/lisp/emms-playlist-sort.el +++ b/lisp/emms-playlist-sort.el @@ -57,12 +57,11 @@ Remember to call `emms-playlist-sort-map-setup' if you modify it." With a prefix argument, decreasingly." attribute) (interactive) (emms-playlist-sort - (lambda (a b) - (if current-prefix-arg - (emms-string> (emms-track-get a (quote ,attribute)) - (emms-track-get b (quote ,attribute))) - (emms-string< (emms-track-get a (quote ,attribute)) - (emms-track-get b (quote ,attribute)))))))) + '(lambda (a b) + (funcall + (if current-prefix-arg 'emms-string> 'emms-string<) + (emms-track-get a (quote ,attribute)) + (emms-track-get b (quote ,attribute))))))) (define-emms-playlist-sort name) (define-emms-playlist-sort info-artist) @@ -91,12 +90,11 @@ With a prefix argument, decreasingly." (interactive) (emms-playlist-sort '(lambda (a b) - (let ((ret (time-less-p - (or (emms-track-get a 'last-played) '(0 0 0)) - (or (emms-track-get b 'last-played) '(0 0 0))))) - (if current-prefix-arg - (not ret) - ret))))) + (funcall + (if current-prefix-arg 'not 'identity) + (time-less-p + (or (emms-track-get a 'last-played) '(0 0 0)) + (or (emms-track-get b 'last-played) '(0 0 0))))))) (defun emms-playlist-sort-by-play-count () "Sort emms playlist by play-count, increasingly. @@ -104,11 +102,21 @@ With a prefix argument, decreasingly." (interactive) (emms-playlist-sort '(lambda (a b) - (let ((ret (< (or (emms-track-get a 'play-count) 0) - (or (emms-track-get b 'play-count) 0)))) - (if current-prefix-arg - (not ret) - ret))))) + (funcall + (if current-prefix-arg 'not 'identity) + (< (or (emms-track-get a 'play-count) 0) + (or (emms-track-get b 'play-count) 0)))))) + +(defun emms-playlist-sort-by-file-extension () + "Sort emms playlist by file extension, increasingly. +With a prefix argument, decreasingly." + (interactive) + (emms-playlist-sort + '(lambda (a b) + (funcall + (if current-prefix-arg 'emms-string> 'emms-string<) + (file-name-extension (emms-track-get a 'name)) + (file-name-extension (emms-track-get b 'name)))))) (defvar emms-playlist-sort-map nil) @@ -122,6 +130,7 @@ With a prefix argument, decreasingly." (define-key map (kbd "b") 'emms-playlist-sort-by-info-album) (define-key map (kbd "l") 'emms-playlist-sort-by-last-played) (define-key map (kbd "t") 'emms-playlist-sort-by-info-title) + (define-key map (kbd "e") 'emms-playlist-sort-by-file-extension) (define-key map (kbd "p") 'emms-playlist-sort-by-info-performer) (define-key map (kbd "y") 'emms-playlist-sort-by-info-year) |