Logo Search packages:      
Sourcecode: herrie version File versions  Download package

scrobbler.c File Reference

Detailed Description

AudioScrobbler submission.

Definition in file scrobbler.c.

#include "stdinc.h"
#include <curl/curl.h>
#include <curl/easy.h>
#include "audio_file.h"
#include "config.h"
#include "gui.h"
#include "md5.h"
#include "scrobbler.h"
#include "util.h"
#include "vfs.h"

Go to the source code of this file.


struct  scrobbler_entry
 An entry in the AudioScrobbler queue, ready to be submitted to AudioScrobbler. More...


#define SCROBBLER_QUEUE_FOREACH(se)   for (se = scrobbler_queue_first; se != NULL; se = se->next)
#define SCROBBLER_URL   "http://post.audioscrobbler.com/?hs=true&p=1.2&c=her&v=0.1&u=%s&t=%u&a=%s"


static size_t scrobbler_curl_concat (void *ptr, size_t size, size_t nmemb, void *stream)
 Concatenate cURL data to a string.
static void scrobbler_hash (time_t t, char out[32])
 Generate a response, based on the password and challenge.
void scrobbler_init (void)
void scrobbler_notify_read (struct audio_file *fd, int eof)
void scrobbler_notify_seek (struct audio_file *fd)
static void scrobbler_queue_dump (void)
 Dump the songs that are still present in the queue to disk.
static int scrobbler_queue_fetch (const char key[32], char **poststr)
 Fetch as much tracks from the AudioScrobbler submission queue (at most 10), generate a HTTP/1.1 POST string for submission and return the amount of tracks described in the POST string.
static void scrobbler_queue_insert_tail (struct scrobbler_entry *se)
 Place a new item in our Scrobbler queue.
static void scrobbler_queue_item_free (struct scrobbler_entry *ent)
 Deallocate an AudioScrobbler queue entry.
static struct scrobbler_entryscrobbler_queue_next (struct scrobbler_entry *se)
 Next item in the Scrobbler queue.
static void scrobbler_queue_remove (int amount)
 Remove a specified amount of tracks from the AudioScrobbler submission queue.
static void scrobbler_queue_remove_head (void)
 Remove the first item from our Scrobbler queue.
static void scrobbler_queue_restore (void)
 Restore the AudioScrobbler queue from a file.
static void * scrobbler_runner_thread (void *unused)
 The actual thread that gets spawned to process AudioScrobbler submission.
static int scrobbler_send_handshake (char *key, char **url)
 Send a handshake to the AudioScrobbler server. Also catch whether the configured password is correct.
static int scrobbler_send_tracks (char *key, const char *url, const char *poststr)
 Submit an amount of tracks to the AudioScrobbler server. Also make sure whether the tracks are submitted properly.
void scrobbler_shutdown (void)
void scrobbler_spawn (void)
static void scrobbler_split_lines (char *str, char *lines[], unsigned int nlines)
 Split a string into multiple nul-terminated lines.


static GCond * scrobbler_avail
 Conditional variable used to notify the avaiability of new tracks ready for submission to AudioScrobbler.
static char scrobbler_enabled = 0
 Flag indicating if the AudioScrobbler thread has already been launched, causing the submission queue to be filled.
static GMutex * scrobbler_lock
 Lock used to provide safe access to the AudioScrobbler queue.
static struct scrobbler_entryscrobbler_queue_first = NULL
 First item in the Scrobbler queue.
static struct scrobbler_entryscrobbler_queue_last = NULL
 Last item in the Scrobbler queue.
static GThread * scrobbler_runner
 Reference to AudioScrobbler submission thread.

Generated by  Doxygen 1.6.0   Back to index