From eaa8db4d476216dc2f33582926eb44ece94a5923 Mon Sep 17 00:00:00 2001 From: Michael Olson Date: Sun, 6 Jan 2008 23:35:00 +0000 Subject: emms-lastfm: Handle case where info-playing-time is unset for the current track darcs-hash:20080106233540-1bfb2-939c6c6c43ad402d4ff21bbefc10eafbafc331e0.gz --- emms-lastfm.el | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/emms-lastfm.el b/emms-lastfm.el index 59c83ee..3e11dd0 100644 --- a/emms-lastfm.el +++ b/emms-lastfm.el @@ -140,17 +140,16 @@ paused track resumes) and sets the track submission timer." (emms-playlist-current-selected-track)) ;; Tracks should be submitted, if they played 240 secs or half of their ;; length, whichever comes first. - (let ((secs (/ (emms-track-get emms-lastfm-current-track - 'info-playing-time) - 2)) + (let ((secs (emms-track-get emms-lastfm-current-track 'info-playing-time)) (type (emms-track-type emms-lastfm-current-track))) - (when (or (eq emms-lastfm-submit-track-types t) - (and (listp emms-lastfm-submit-track-types) - (memq type emms-lastfm-submit-track-types))) + (when (and secs + (or (eq emms-lastfm-submit-track-types t) + (and (listp emms-lastfm-submit-track-types) + (memq type emms-lastfm-submit-track-types)))) (when (> secs 240) (setq secs 240)) - (unless (< secs 15) ;; Skip titles shorter than 30 seconds - (setq secs (- secs emms-playing-time)) + (unless (< secs 30) ;; Skip titles shorter than 30 seconds + (setq secs (- (/ secs 2) emms-playing-time)) (unless (< secs 0) (setq emms-lastfm-timer (run-with-timer secs nil 'emms-lastfm-submit-track))))))) -- cgit v1.2.3