diff options
author | Yoni Rabkin <yoni@rabkins.net> | 2018-07-08 21:23:09 -0400 |
---|---|---|
committer | Yoni Rabkin <yoni@rabkins.net> | 2018-07-08 21:23:09 -0400 |
commit | 4cc4dd97c40f4275f1e4aba0ac5964feb1a7e278 (patch) | |
tree | ce83ec3321559925c22a2577e8c72717215a8703 /lisp | |
parent | e91b00ef19c2078d41deeec041150e61b0d0f0fa (diff) |
* lisp/emms-score.el: Use `emms-ok-track-function'
Simplify and correct the way emms-score skips tracks.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emms-score.el | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/lisp/emms-score.el b/lisp/emms-score.el index bb6d433..8c783c5 100644 --- a/lisp/emms-score.el +++ b/lisp/emms-score.el @@ -1,7 +1,7 @@ ;;; emms-score.el --- Scoring system for mp3player ;; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, -;; 2009 Free Software Foundation, Inc. +;; 2009, 2018 Free Software Foundation, Inc. ;; Authors: Jean-Philippe Theberge <jphiltheberge@videotron.ca>, ;; Yoni Rabkin <yrk@gnu.org> @@ -87,13 +87,13 @@ off otherwise." (if (and arg (> arg 0)) (progn (setq emms-score-enabled-p t) - (setq emms-player-next-function 'emms-score-next-noerror) (emms-score-load-hash) + (setq emms-ok-track-function 'emms-score-ok-track-function) (unless noninteractive (add-hook 'kill-emacs-hook 'emms-score-save-hash))) (setq emms-score-enabled-p nil) - (setq emms-player-next-function 'emms-next-noerror) (emms-score-save-hash) + (setq emms-ok-track-function 'emms-default-ok-track-function) (remove-hook 'kill-emacs-hook 'emms-score-save-hash))) ;;;###autoload @@ -209,25 +209,9 @@ The score hash is automatically saved." "Return file of track at point in emms-playlist buffer." (emms-track-get (emms-playlist-track-at) 'name)) -(defun emms-score-next-noerror () - "Run `emms-next-noerror' with score check. -See also `emms-next-noerror'." - (interactive) - (when emms-player-playing-p - (error "A track is already being played")) - (cond (emms-repeat-track - (emms-start)) - ((condition-case nil - (progn - (emms-playlist-current-select-next) - t) - (error nil)) - (if (emms-score-check-score - (emms-score-current-selected-track-filename)) - (emms-start) - (emms-score-next-noerror))) - (t - (message "No next track in playlist")))) +(defun emms-score-ok-track-function (track) + "Decide if to skip or play TRACK." + (emms-score-check-score (emms-track-get track 'name))) (defun emms-score-save-hash () "Save score hash in `emms-score-file'." |