aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2008-01-06 23:35:00 +0000
committerMichael Olson <mwolson@gnu.org>2008-01-06 23:35:00 +0000
commiteaa8db4d476216dc2f33582926eb44ece94a5923 (patch)
tree6ff833051e754ff7865bb373c2746e41259497ab
parenteab6e8de15b92970e5667c1709b4a1cab1a02e5c (diff)
emms-lastfm: Handle case where info-playing-time is unset for the current track
darcs-hash:20080106233540-1bfb2-939c6c6c43ad402d4ff21bbefc10eafbafc331e0.gz
-rw-r--r--emms-lastfm.el15
1 files 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)))))))