Code Monkey home page Code Monkey logo

scrobsub's Introduction

ScrobSub
========
A cross-platform plain-c library that allows you to submit scrobbles to
Last.fm 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
fit.

Max Howell <[email protected]>


Usage
=====
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:

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

OS X
----
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

Windows
-------
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:

SCROBSUB_CLIENT_VERSION
SCROBSUB_CLIENT_ID
SCROBSUB_API_KEY
SCROBSUB_SHARED_SECRET

What these represent should be apparent after reading: http://last.fm/api

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 Last.fm Audioscrobbler application:

#define SCROBSUB_ALWAYS_RELAY 1


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.

scrobsub's People

Contributors

mxcl avatar rj avatar

Stargazers

Angus H. avatar  avatar J.P. Illanes avatar  avatar  avatar doug mansell avatar Shawn Ledbetter avatar Andrew Carter avatar Joshua Suggs avatar

Watchers

 avatar James Cloos avatar Vinoth Energetic avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.