From 1d3cb0de6c78bf62e9dca6a3c1715147da9bfc33 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sat, 16 Dec 2006 13:22:00 +0000 Subject: fix-regression-in-lastfm.dpatch My last path enabled emms-lastfm.el to submit tracks even if you paused them. I tested this extensively! But I didn't test if it still submits them if you don't pause it. Of course it didn't. ;-) The problem was that I rely on `emms-playing-time' to calculate when a track has to be submitted. But in `emms-player-started-hook' my new track function was run *before* `emms-playing-time' was set to 0 again. darcs-hash:20061216132209-c06f4-c25c2f5849e7492cec0cc0b95e347ce24db2a83d.gz --- emms-lastfm.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'emms-lastfm.el') diff --git a/emms-lastfm.el b/emms-lastfm.el index 402021e..a9308a8 100644 --- a/emms-lastfm.el +++ b/emms-lastfm.el @@ -114,8 +114,10 @@ the current track, too." (progn (add-hook 'emms-player-started-hook 'emms-lastfm-handshake-if-needed) + ;; Has to be appended, because it has to run after + ;; `emms-playing-time-start' (add-hook 'emms-player-started-hook - 'emms-lastfm-new-track-function) + 'emms-lastfm-new-track-function t) (add-hook 'emms-player-stopped-hook 'emms-lastfm-cancel-timer) (add-hook 'emms-player-paused-hook @@ -126,9 +128,9 @@ the current track, too." (remove-hook 'emms-player-started-hook 'emms-lastfm-new-track-function) (remove-hook 'emms-player-stopped-hook - 'emms-lastfm-pause) - (remove-hook 'emms-player-paused-hook 'emms-lastfm-cancel-timer) + (remove-hook 'emms-player-paused-hook + 'emms-lastfm-pause) (cancel-timer emms-lastfm-timer) (setq emms-lastfm-md5-challenge nil emms-lastfm-submit-url nil @@ -136,7 +138,6 @@ the current track, too." emms-lastfm-current-track nil) (message "EMMS Last.fm plugin deactivated.")))) - (defun read-line () (buffer-substring-no-properties (line-beginning-position) (line-end-position))) -- cgit v1.2.3