A library for scrobbling to last.fm
cl-scrobbler is a Common Lisp library for scrobbling to last.fm.
It was initially designed to make it trivial to build a last.fm plugin for shuffletron but it should be useful to other hackers interested in scrobbling via CL, for whatever reason.
You could git clone this library and make sure it's path on your computer is on your
asdf:*central-registry* but I strongly recommend that you instead use Zach Beane's positively delightful quicklisp.
- Using quicklisp: Start your lisp. Run
(ql:quickload :cl-scrobbler). Done!
- Install cl-scrobbler
- Check out the docs or see how I used it below.
The Shuffletron Example
It is recommended to simply mirror the shuffletron plugin. Here's a handwavy explanation of that code:
You should set
*song-info-fn* so that the
*song-info* variables can be updated with the
current track position and metadata, respectively. Then you can have hooks
in your application to call
maybe-queue-scrobble when a song ends,
update-song-info when a song begins, and, if applicable,
update-last-seek after a seek finishes and
skipping the track.
Finally, you should fire off a thread to call
scrobbler-loop which will do the work of creating or restoring
the session key and cache and then scrobbling tracks when possible.