aboutsummaryrefslogtreecommitdiff
path: root/emms-lastfm.el
diff options
context:
space:
mode:
authorMichael Olson <mwolson@gnu.org>2007-08-19 17:02:00 +0000
committerMichael Olson <mwolson@gnu.org>2007-08-19 17:02:00 +0000
commit46631e0d06139949be31afdf512f0d95929830d9 (patch)
treec179b1824369a276f9d6196f63c7de8a19b629e0 /emms-lastfm.el
parentec320ca6d98d0ec22ce286bb8ed8ce99ee6aa0a5 (diff)
lastfm: Allow user to specify which type of tracks get submitted
darcs-hash:20070819170235-1bfb2-43caff981d10cc50fae838ea6c67fb106d0c4db1.gz
Diffstat (limited to 'emms-lastfm.el')
-rw-r--r--emms-lastfm.el37
1 files changed, 29 insertions, 8 deletions
diff --git a/emms-lastfm.el b/emms-lastfm.el
index ebbed86..9503da9 100644
--- a/emms-lastfm.el
+++ b/emms-lastfm.el
@@ -101,6 +101,23 @@
:type 'boolean
:group 'emms-lastfm)
+(defcustom emms-lastfm-submit-track-types '(file)
+ "Specify what types of tracks to submit to Last.fm.
+The default is to only submit files.
+
+To submit every track to Last.fm, set this to t.
+
+Note that it is not very meaningful to submit playlists,
+streamlists, or Last.fm streams to Last.fm."
+ :type '(choice (const :tag "All" t)
+ (set :tag "Types"
+ (const :tag "Files" file)
+ (const :tag "URLs" url)
+ (const :tag "Playlists" playlist)
+ (const :tag "Streamlists" streamlist)
+ (const :tag "Last.fm streams" lastfm)))
+ :group 'emms-lastfm)
+
(defconst emms-lastfm-server "http://post.audioscrobbler.com/"
"The last.fm server responsible for the handshaking
procedure. Only for internal use.")
@@ -125,14 +142,18 @@ paused track resumes) and sets the track submission timer."
;; length, whichever comes first.
(let ((secs (/ (emms-track-get emms-lastfm-current-track
'info-playing-time)
- 2)))
- (when (> secs 240)
- (setq secs 240))
- (unless (< secs 15) ;; Skip titles shorter than 30 seconds
- (setq secs (- secs emms-playing-time))
- (unless (< secs 0)
- (setq emms-lastfm-timer
- (run-with-timer secs nil 'emms-lastfm-submit-track))))))
+ 2))
+ (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 (> secs 240)
+ (setq secs 240))
+ (unless (< secs 15) ;; Skip titles shorter than 30 seconds
+ (setq secs (- secs emms-playing-time))
+ (unless (< secs 0)
+ (setq emms-lastfm-timer
+ (run-with-timer secs nil 'emms-lastfm-submit-track)))))))
(defun emms-lastfm-cancel-timer ()
"Cancels `emms-lastfm-timer' if it is running."