Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Portable scrobbling solution in plain c
branch: master


So users can know if the scrobbles are being relayed.
latest commit 2ad2f6131e
Max Howell authored


A cross-platform plain-c library that allows you to submit scrobbles to using the official Audioscrobbler application, or if that isn't
installed, independently.

The license is BSD, so use it in commercial or open source software as you see

Max Howell <>

This does not compile to a dynamic library. You need to compile it into your
application. Indeed, (on Linux) this is duplication, but it's a very small
amount of code, and we provide many options for which libraries it uses.

scrosub.c does the actual scrobbling, however it depends on a number of 
platform specific scrobsub_* functions. If you like you can write your own (if
perhaps you'd contribute them to the project?), however we provide default
implementations for all major platforms:

gcc -std=c99 scrobsub.c auth-libxml2 http-curl md5.c relay.c -lcrypto -lxml2 -lcurl

Tiger and above are shipped with all the required libraries from the Linux
example so you can use those. This is preferable if you don't run a Cocoa 
event loop. If you do though, we provide a Cocoa implementation:

gcc scrobsub.c scrobsub.m md5.c relay.c -FCocoa

cl /TP scrobsub.c scrobsub-winsock.c md5.c relay.c

Note that scrobsub.c is C99, and Visual Studio still isn't compliant, so you
need to compile with the /TP switch; this compiles the files as though they
are C++. You can still link to the C-runtime though.

All platforms
You need to define a number of preprocessor constants:


What these represent should be apparent after reading:

Relay only
If you have already built a scrobbling solution and want to stick with it then
you may consider only compiling in the relay code. At program start call
scrobsub_launch_audioscrobbler(), if that function returns false use your own
code otherwise use the scrobsub_relay functions. The rationale for this is
that if the user has installed the official client then they probably would
like you to use it.

Practical concerns
The library is synchronous. If you don't want to block the thread that calls 
them, you will need to call these functions in a separate thread. Or you can
rely on the user installing the official Audioscrobbler application:


Development Notes
Efficiency in memory consumption was prioritised because we want to be as 
little a burden to other software as possible. As a result the code is 
quite unreadable. Sorry about that.
Something went wrong with that request. Please try again.