https://github.com/redline6561/cl-scrobbler.git
git clone 'https://github.com/redline6561/cl-scrobbler.git'
(ql:quickload :cl-scrobbler)
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.
(ql:quickload :cl-scrobbler)
. Done!It is recommended to simply mirror the shuffletron plugin. Here's a handwavy explanation of that code:
You should set *song-time-fn*
and *song-info-fn*
so that the
*last-seek*
and *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 update-skipped
after
skipping the track.
Finally, you should fire off a thread to call scrobbler-init
and
scrobbler-loop
which will do the work of creating or restoring
the session key and cache and then scrobbling tracks when possible.