Mercurial > audlegacy-plugins
annotate src/scrobbler/scrobbler.c @ 348:314b7ac7f771 trunk
[svn] - handle no account data gracefully (e.g. you only use one of the
multiple services available now)
author | nenolod |
---|---|
date | Sat, 09 Dec 2006 02:43:27 -0800 |
parents | 03c1ae10bc8d |
children | 192004e2a1b7 |
rev | line source |
---|---|
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
1 #include <pthread.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
2 #include <limits.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
3 #include <stdlib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 #include <stdarg.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 #include <curl/curl.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 #include <stdio.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 #include "fmt.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 #include "md5.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 #include "scrobbler.h" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 #include "config.h" |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
12 #include "settings.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
13 #include <glib.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
14 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
15 #include <audacious/titlestring.h> |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
16 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 #define SCROBBLER_HS_URL "http://post.audioscrobbler.com" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 #define SCROBBLER_CLI_ID "aud" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 #define SCROBBLER_HS_WAIT 1800 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
20 #define SCROBBLER_SB_WAIT 10 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 #define SCROBBLER_VERSION "1.1" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
22 #define SCROBBLER_IMPLEMENTATION "0.1" /* This is the implementation, not the player version. */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
23 #define SCROBBLER_SB_MAXLEN 1024 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
24 #define CACHE_SIZE 1024 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
25 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 /* Scrobblerbackend for xmms plugin, first draft */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 static int sc_hs_status, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 sc_hs_timeout, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 sc_hs_errors, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 sc_sb_errors, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 sc_bad_users, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 sc_submit_interval, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 sc_submit_timeout, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 sc_srv_res_size, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 sc_giveup, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 sc_major_error_present; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 static char *sc_submit_url, |
348
314b7ac7f771
[svn] - handle no account data gracefully (e.g. you only use one of the
nenolod
parents:
344
diff
changeset
|
40 *sc_username = NULL, |
314b7ac7f771
[svn] - handle no account data gracefully (e.g. you only use one of the
nenolod
parents:
344
diff
changeset
|
41 *sc_password = NULL, |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 *sc_challenge_hash, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 sc_response_hash[33], |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
44 *sc_srv_res, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
45 sc_curl_errbuf[CURL_ERROR_SIZE], |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
46 *sc_major_error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
47 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 static void dump_queue(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
49 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
50 /**** Queue stuff ****/ |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
51 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
52 #define I_ARTIST(i) i->artist |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
53 #define I_TITLE(i) i->title |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
54 #define I_TIME(i) i->utctime |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
55 #define I_LEN(i) i->len |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
56 #define I_MB(i) i->mb |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
57 #define I_ALBUM(i) i->album |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
58 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
59 typedef struct { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
60 char *artist, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
61 *title, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
62 *mb, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
63 *album, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
64 *utctime, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
65 len[16]; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
66 int numtries; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
67 void *next; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
68 } item_t; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
69 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
70 static item_t *q_queue = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
71 static item_t *q_queue_last = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
72 static int q_nitems; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
73 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
74 static void q_item_free(item_t *item) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
75 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
76 if (item == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
77 return; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
78 curl_free(item->artist); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
79 curl_free(item->title); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
80 curl_free(item->utctime); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
81 curl_free(item->mb); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
82 curl_free(item->album); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
83 free(item); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
84 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
85 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
86 static void q_put(TitleInput *tuple, int len) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
87 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
88 item_t *item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
89 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
90 item = malloc(sizeof(item_t)); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
91 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
92 item->artist = fmt_escape(tuple->performer); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
93 item->title = fmt_escape(tuple->track_name); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
94 item->utctime = fmt_escape(fmt_timestr(time(NULL), 1)); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
95 snprintf(item->len, sizeof(item->len), "%d", len); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
96 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
97 #ifdef NOTYET |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
98 if(tuple->mb == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
99 #endif |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
100 item->mb = fmt_escape(""); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
101 #ifdef NOTYET |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
102 else |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
103 item->mb = fmt_escape((char*)tuple->mb); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
104 #endif |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
105 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
106 if(tuple->album_name == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
107 item->album = fmt_escape(""); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
108 else |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
109 item->album = fmt_escape((char*)tuple->album_name); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
110 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
111 q_nitems++; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
112 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
113 item->next = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
114 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
115 if(q_queue_last == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
116 q_queue = q_queue_last = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
117 else |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
118 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
119 q_queue_last->next = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
120 q_queue_last = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
121 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
122 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
123 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
124 static item_t *q_put2(char *artist, char *title, char *len, char *time, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
125 char *album, char *mb) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
126 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
127 char *temp = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
128 item_t *item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
129 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
130 item = calloc(1, sizeof(item_t)); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
131 temp = fmt_unescape(artist); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
132 item->artist = fmt_escape(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
133 curl_free(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
134 temp = fmt_unescape(title); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
135 item->title = fmt_escape(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
136 curl_free(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
137 memcpy(item->len, len, sizeof(len)); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
138 temp = fmt_unescape(time); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
139 item->utctime = fmt_escape(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
140 curl_free(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
141 temp = fmt_unescape(album); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
142 item->album = fmt_escape(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
143 curl_free(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
144 temp = fmt_unescape(mb); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
145 item->mb = fmt_escape(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
146 curl_free(temp); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
147 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
148 q_nitems++; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
149 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
150 item->next = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
151 if(q_queue_last == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
152 q_queue = q_queue_last = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
153 else |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
154 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
155 q_queue_last->next = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
156 q_queue_last = item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
157 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
158 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
159 return item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
160 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
161 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
162 static item_t *q_peek(void) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
163 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
164 if (q_nitems == 0) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
165 return NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
166 return q_queue; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
167 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
168 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
169 static item_t *q_peekall(int rewind) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
170 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
171 static item_t *citem = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
172 item_t *temp_item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
173 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
174 if (rewind) { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
175 citem = q_queue; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
176 return NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
177 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
178 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
179 temp_item = citem; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
180 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
181 if(citem != NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
182 citem = citem->next; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
183 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
184 return temp_item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
185 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
186 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
187 static int q_get(void) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
188 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
189 item_t *item; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
190 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
191 if (q_nitems == 0) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
192 return 0; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
193 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
194 item = q_queue; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
195 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
196 if(item == NULL) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
197 return 0; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
198 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
199 q_nitems--; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
200 q_queue = q_queue->next; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
201 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
202 q_item_free(item); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
203 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
204 if (q_nitems == 0) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
205 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
206 q_queue_last = NULL; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
207 return 0; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
208 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
209 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
210 return -1; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
211 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
212 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
213 static void q_free(void) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
214 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
215 while (q_get()); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
216 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
217 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
218 static int q_len(void) |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
219 { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
220 return q_nitems; |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
221 } |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
222 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
223 /* Error functions */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
224 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
225 static void sc_throw_error(char *errortxt) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
226 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
227 sc_major_error_present = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
228 if(sc_major_error == NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
229 sc_major_error = strdup(errortxt); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
230 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
231 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
234 int sc_catch_error(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
235 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
236 return sc_major_error_present; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
237 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
239 char *sc_fetch_error(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
240 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
241 return sc_major_error; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
242 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
243 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
244 void sc_clear_error(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
245 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
246 sc_major_error_present = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
247 if(sc_major_error != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
248 free(sc_major_error); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
249 sc_major_error = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
250 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
251 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
252 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
253 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
254 static size_t sc_store_res(void *ptr, size_t size, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
255 size_t nmemb, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
256 void *stream __attribute__((unused))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
257 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
258 int len = size * nmemb; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
259 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
260 sc_srv_res = realloc(sc_srv_res, sc_srv_res_size + len + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
261 memcpy(sc_srv_res + sc_srv_res_size, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
262 ptr, len); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
263 sc_srv_res_size += len; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
264 return len; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
265 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
266 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
267 static void sc_free_res(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
268 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
269 if(sc_srv_res != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
270 free(sc_srv_res); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
271 sc_srv_res = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
272 sc_srv_res_size = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
273 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
274 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
275 static int sc_parse_hs_res(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
276 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
277 char *interval; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
278 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
279 if (!sc_srv_res_size) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
280 pdebug("No reply from server", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
281 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
282 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
283 *(sc_srv_res + sc_srv_res_size) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
284 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
285 if (!strncmp(sc_srv_res, "FAILED ", 7)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
286 interval = strstr(sc_srv_res, "INTERVAL"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
287 if(!interval) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
288 pdebug("missing INTERVAL", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
289 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
290 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
291 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
292 *(interval - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
293 sc_submit_interval = strtol(interval + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 /* Throwing a major error, just in case */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 /* sc_throw_error(fmt_vastr("%s", sc_srv_res)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 sc_hs_errors++; */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 pdebug(fmt_vastr("error: %s", sc_srv_res), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
300 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
302 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
304 if (!strncmp(sc_srv_res, "UPDATE ", 7)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
305 interval = strstr(sc_srv_res, "INTERVAL"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
306 if(!interval) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 pdebug("missing INTERVAL", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
311 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 *(interval - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
313 sc_submit_interval = strtol(interval + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
314 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
315 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
316 sc_submit_url = strchr(strchr(sc_srv_res, '\n') + 1, '\n') + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
317 *(sc_submit_url - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
318 sc_submit_url = strdup(sc_submit_url); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
319 sc_challenge_hash = strchr(sc_srv_res, '\n') + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
320 *(sc_challenge_hash - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
321 sc_challenge_hash = strdup(sc_challenge_hash); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
322 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
323 /* Throwing major error. Need to alert client to update. */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
324 sc_throw_error(fmt_vastr("Please update Audacious.\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
325 "Update available at: http://audacious-media-player.org")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
326 pdebug(fmt_vastr("update client: %s", sc_srv_res + 7), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
327 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
328 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
329 * Russ isn't clear on whether we can submit with a not-updated |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
330 * client. Neither is RJ. I use what we did before. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 sc_giveup = -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
333 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
334 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
335 if (!strncmp(sc_srv_res, "UPTODATE\n", 9)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
336 sc_bad_users = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 interval = strstr(sc_srv_res, "INTERVAL"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 if (!interval) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
340 pdebug("missing INTERVAL", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
341 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
342 * This is probably a bad thing, but Russ seems to |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
343 * think its OK to assume that an UPTODATE response |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
344 * may not have an INTERVAL... We return -1 anyway. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
345 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
346 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
347 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
348 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
349 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
350 *(interval - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
351 sc_submit_interval = strtol(interval + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
352 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
353 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
354 sc_submit_url = strchr(strchr(sc_srv_res, '\n') + 1, '\n') + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
355 *(sc_submit_url - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
356 sc_submit_url = strdup(sc_submit_url); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
357 sc_challenge_hash = strchr(sc_srv_res, '\n') + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
358 *(sc_challenge_hash - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
359 sc_challenge_hash = strdup(sc_challenge_hash); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
360 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
361 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
362 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
363 if(!strncmp(sc_srv_res, "BADUSER", 7)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
364 /* Throwing major error. */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
365 sc_throw_error("Incorrect username/password.\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
366 "Please fix in configuration."); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
367 pdebug("incorrect username/password", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
368 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
369 interval = strstr(sc_srv_res, "INTERVAL"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
370 if(!interval) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
371 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
372 pdebug("missing INTERVAL", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
373 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
374 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
375 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
376 *(interval - 1) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
377 sc_submit_interval = strtol(interval + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
378 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
379 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
380 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
381 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
382 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
383 pdebug(fmt_vastr("unknown server-reply '%s'", sc_srv_res), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
384 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
385 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
386 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
387 static void hexify(char *pass, int len) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
388 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
389 char *bp = sc_response_hash; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
390 char hexchars[] = "0123456789abcdef"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
391 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
392 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
393 memset(sc_response_hash, 0, sizeof(sc_response_hash)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
394 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
395 for(i = 0; i < len; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
396 *(bp++) = hexchars[(pass[i] >> 4) & 0x0f]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
397 *(bp++) = hexchars[pass[i] & 0x0f]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
398 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
399 *bp = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
400 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
401 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
402 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
403 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
404 static int sc_handshake(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
405 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
406 int status; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
407 char buf[4096]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
408 CURL *curl; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
409 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
410 snprintf(buf, sizeof(buf), "%s/?hs=true&p=%s&c=%s&v=%s&u=%s", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
411 SCROBBLER_HS_URL, SCROBBLER_VERSION, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
412 SCROBBLER_CLI_ID, SCROBBLER_IMPLEMENTATION, sc_username); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
413 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
414 curl = curl_easy_init(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
415 curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
416 curl_easy_setopt(curl, CURLOPT_URL, buf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
417 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
418 sc_store_res); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
419 memset(sc_curl_errbuf, 0, sizeof(sc_curl_errbuf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
420 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, sc_curl_errbuf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
421 curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
422 status = curl_easy_perform(curl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
423 curl_easy_cleanup(curl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
424 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
425 sc_hs_timeout = time(NULL) + SCROBBLER_HS_WAIT; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
426 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
427 if (status) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
428 pdebug(sc_curl_errbuf, DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
429 sc_hs_errors++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
430 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
431 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
432 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
433 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
434 if (sc_parse_hs_res()) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
435 sc_hs_errors++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
436 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
437 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
438 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
439 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
440 if (sc_challenge_hash != NULL) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
441 md5_state_t md5state; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
442 unsigned char md5pword[16]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
443 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
444 md5_init(&md5state); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
445 /*pdebug(fmt_vastr("Pass Hash: %s", sc_password), DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
446 md5_append(&md5state, (unsigned const char *)sc_password, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
447 strlen(sc_password)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
448 /*pdebug(fmt_vastr("Challenge Hash: %s", sc_challenge_hash), DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
449 md5_append(&md5state, (unsigned const char *)sc_challenge_hash, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
450 strlen(sc_challenge_hash)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
451 md5_finish(&md5state, md5pword); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
452 hexify((char*)md5pword, sizeof(md5pword)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
453 /*pdebug(fmt_vastr("Response Hash: %s", sc_response_hash), DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
454 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
455 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
456 sc_hs_errors = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
457 sc_hs_status = 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
458 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
459 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
460 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
461 pdebug(fmt_vastr("submiturl: %s - interval: %d", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
462 sc_submit_url, sc_submit_interval), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
463 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
464 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
465 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
466 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
467 static int sc_parse_sb_res(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
468 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
469 char *ch, *ch2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
470 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
471 if (!sc_srv_res_size) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
472 pdebug("No response from server", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
473 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
474 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
475 *(sc_srv_res + sc_srv_res_size) = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
476 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
477 if (!strncmp(sc_srv_res, "OK", 2)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
478 if ((ch = strstr(sc_srv_res, "INTERVAL"))) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
479 sc_submit_interval = strtol(ch + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
480 pdebug(fmt_vastr("got new interval: %d", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
481 sc_submit_interval), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
482 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
483 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
484 pdebug(fmt_vastr("submission ok: %s", sc_srv_res), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
485 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
486 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
487 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
488 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
489 if (!strncmp(sc_srv_res, "BADAUTH", 7)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
490 if ((ch = strstr(sc_srv_res, "INTERVAL"))) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
491 sc_submit_interval = strtol(ch + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
492 pdebug(fmt_vastr("got new interval: %d", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
493 sc_submit_interval), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
494 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
495 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
496 pdebug("incorrect username/password", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
497 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
498 sc_giveup = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
499 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
500 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
501 * We obviously aren't authenticated. The server might have |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
502 * lost our handshake status though, so let's try |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
503 * re-handshaking... This might not be proper. |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
504 * (we don't give up) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
505 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
506 sc_hs_status = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
507 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
508 if(sc_challenge_hash != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
509 free(sc_challenge_hash); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
510 if(sc_submit_url != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
511 free(sc_submit_url); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
512 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
513 sc_challenge_hash = sc_submit_url = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
514 sc_bad_users++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
515 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
516 if(sc_bad_users > 2) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
517 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
518 pdebug("3 BADAUTH returns on submission. Halting " |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
519 "submissions until login fixed.", DEBUG) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
520 sc_throw_error("Incorrect username/password.\n" |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
521 "Please fix in configuration."); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
522 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
523 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
524 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
525 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
526 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
527 if (!strncmp(sc_srv_res, "FAILED", 6)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
528 if ((ch = strstr(sc_srv_res, "INTERVAL"))) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
529 sc_submit_interval = strtol(ch + 8, NULL, 10); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
530 pdebug(fmt_vastr("got new interval: %d", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
531 sc_submit_interval), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
532 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
533 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
534 /* This could be important. (Such as FAILED - Get new plugin) */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
535 /*sc_throw_error(fmt_vastr("%s", sc_srv_res));*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
536 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
537 pdebug(sc_srv_res, DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
538 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
539 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
540 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
541 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
542 if (!strncmp(sc_srv_res, "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">", 50)) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
543 ch = strstr(sc_srv_res, "<TITLE>") + 7; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
544 ch2 = strstr(sc_srv_res, "</TITLE>"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
545 *ch2 = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
546 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
547 pdebug(fmt_vastr("HTTP Error (%d): '%s'", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
548 atoi(ch), ch + 4), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
549 *ch2 = '<'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
550 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
551 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
552 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
553 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
554 pdebug(fmt_vastr("unknown server-reply %s", sc_srv_res), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
555 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
556 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
557 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
558 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
559 static gchar *sc_itemtag(char c, int n, char *str) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
560 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
561 static char buf[SCROBBLER_SB_MAXLEN]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
562 snprintf(buf, SCROBBLER_SB_MAXLEN, "&%c[%d]=%s", c, n, str); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
563 return buf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
564 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
565 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
566 #define cfa(f, l, n, v) \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
567 curl_formadd(f, l, CURLFORM_COPYNAME, n, \ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
568 CURLFORM_PTRCONTENTS, v, CURLFORM_END) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
569 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
570 static int sc_generateentry(GString *submission) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
571 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
572 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
573 item_t *item; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
574 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
575 i = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
576 #ifdef ALLOW_MULTIPLE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
577 q_peekall(1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
578 while ((item = q_peekall(0)) && i < 10) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
579 #else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
580 item = q_peek(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
581 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
582 if (!item) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
583 return i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
584 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
585 g_string_append(submission,sc_itemtag('a',i,I_ARTIST(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
586 g_string_append(submission,sc_itemtag('t',i,I_TITLE(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
587 g_string_append(submission,sc_itemtag('l',i,I_LEN(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
588 g_string_append(submission,sc_itemtag('i',i,I_TIME(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
589 g_string_append(submission,sc_itemtag('m',i,I_MB(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
590 g_string_append(submission,sc_itemtag('b',i,I_ALBUM(item))); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
591 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
592 pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%s i[%d]=%s m[%d]=%s b[%d]=%s", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
593 i, I_ARTIST(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
594 i, I_TITLE(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
595 i, I_LEN(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
596 i, I_TIME(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
597 i, I_MB(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
598 i, I_ALBUM(item)), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
599 #ifdef ALLOW_MULTIPLE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
600 i++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
601 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
602 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
603 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
604 return i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
605 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
606 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
607 static int sc_submitentry(gchar *entry) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
608 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
609 CURL *curl; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
610 /* struct HttpPost *post = NULL , *last = NULL; */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
611 int status; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
612 GString *submission; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
613 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
614 curl = curl_easy_init(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
615 curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
616 curl_easy_setopt(curl, CURLOPT_URL, sc_submit_url); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
617 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
618 sc_store_res); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
619 curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
620 curl_easy_setopt(curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
621 /*cfa(&post, &last, "debug", "failed");*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
622 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
623 /*pdebug(fmt_vastr("Username: %s", sc_username), DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
624 submission = g_string_new("u="); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
625 g_string_append(submission,(gchar *)sc_username); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
626 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
627 /*pdebug(fmt_vastr("Response Hash: %s", sc_response_hash), DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
628 g_string_append(submission,"&s="); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
629 g_string_append(submission,(gchar *)sc_response_hash); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
630 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
631 g_string_append(submission, entry); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
632 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
633 curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (char *)submission->str); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
634 memset(sc_curl_errbuf, 0, sizeof(sc_curl_errbuf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
635 curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, sc_curl_errbuf); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
636 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
637 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
638 curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
639 curl_easy_setopt(curl, CURLOPT_TIMEOUT, SCROBBLER_SB_WAIT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
640 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
641 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
642 status = curl_easy_perform(curl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
643 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
644 curl_easy_cleanup(curl); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
645 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
646 g_string_free(submission,TRUE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
647 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
648 if (status) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
649 pdebug(sc_curl_errbuf, DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
650 sc_sb_errors++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
651 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
652 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
653 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
654 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
655 if (sc_parse_sb_res()) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
656 sc_sb_errors++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
657 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
658 pdebug(fmt_vastr("Retrying in %d secs, %d elements in queue", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
659 sc_submit_interval, q_len()), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
660 return -1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
661 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
662 sc_free_res(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
663 return 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
664 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
665 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
666 static void sc_handlequeue(GMutex *mutex) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
667 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
668 GString *submitentry; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
669 int nsubmit; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
670 int wait; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
671 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
672 if(sc_submit_timeout < time(NULL) && sc_bad_users < 3) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
673 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
674 submitentry = g_string_new(""); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
675 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
676 g_mutex_lock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
677 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
678 nsubmit = sc_generateentry(submitentry); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
679 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
680 g_mutex_unlock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
681 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
682 if (nsubmit > 0) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
683 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
684 pdebug(fmt_vastr("Number submitting: %d", nsubmit), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
685 pdebug(fmt_vastr("Submission: %s", submitentry->str), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
686 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
687 if(!sc_submitentry(submitentry->str)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
688 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
689 g_mutex_lock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
690 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
691 #ifdef ALLOW_MULTIPLE |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
692 q_free(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
693 #else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
694 q_get(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
695 #endif |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
696 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
697 * This should make sure that the queue doesn't |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
698 * get submitted multiple times on a nasty |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
699 * segfault... |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
700 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
701 dump_queue(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
702 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
703 g_mutex_unlock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
704 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
705 sc_sb_errors = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
706 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
707 if(sc_sb_errors) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
708 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
709 if(sc_sb_errors < 5) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
710 /* Retry after 1 min */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
711 wait = 60; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
712 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
713 wait = /* sc_submit_interval + */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
714 ( ((sc_sb_errors - 5) < 7) ? |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
715 (60 << (sc_sb_errors-5)) : |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
716 7200 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
717 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
718 sc_submit_timeout = time(NULL) + wait; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
719 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
720 pdebug(fmt_vastr("Error while submitting. " |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
721 "Retrying after %d seconds.", wait), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
722 DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
723 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
724 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
725 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
726 g_string_free(submitentry, TRUE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
727 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
728 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
729 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
730 static void read_cache(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
731 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
732 FILE *fd; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
733 char buf[PATH_MAX], *cache = NULL, *ptr1, *ptr2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
734 int cachesize, written, i = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
735 item_t *item; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
736 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
737 cachesize = written = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
738 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
739 snprintf(buf, sizeof(buf), "%s/.audacious/scrobblerqueue.txt", g_get_home_dir()); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
740 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
741 if (!(fd = fopen(buf, "r"))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
742 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
743 pdebug(fmt_vastr("Opening %s", buf), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
744 while(!feof(fd)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
745 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
746 cachesize += CACHE_SIZE; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
747 cache = realloc(cache, cachesize + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
748 written += fread(cache + written, 1, CACHE_SIZE, fd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
749 cache[written] = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
750 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
751 fclose(fd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
752 ptr1 = cache; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
753 while(ptr1 < cache + written - 1) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
754 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
755 char *artist, *title, *len, *time, *album, *mb; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
756 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
757 pdebug("Pushed:", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
758 ptr2 = strchr(ptr1, ' '); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
759 artist = calloc(1, ptr2 - ptr1 + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
760 strncpy(artist, ptr1, ptr2 - ptr1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
761 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
762 ptr2 = strchr(ptr1, ' '); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
763 title = calloc(1, ptr2 - ptr1 + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
764 strncpy(title, ptr1, ptr2 - ptr1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
765 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
766 ptr2 = strchr(ptr1, ' '); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
767 len = calloc(1, ptr2 - ptr1 + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
768 strncpy(len, ptr1, ptr2 - ptr1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
769 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
770 ptr2 = strchr(ptr1, ' '); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
771 time = calloc(1, ptr2 - ptr1 + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
772 strncpy(time, ptr1, ptr2 - ptr1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
773 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
774 ptr2 = strchr(ptr1, ' '); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
775 album = calloc(1, ptr2 - ptr1 + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
776 strncpy(album, ptr1, ptr2 - ptr1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
777 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
778 ptr2 = strchr(ptr1, '\n'); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
779 if(ptr2 != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
780 *ptr2 = '\0'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
781 mb = calloc(1, strlen(ptr1) + 1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
782 strncpy(mb, ptr1, strlen(ptr1)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
783 if(ptr2 != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
784 *ptr2 = '\n'; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
785 /* Why is our save printing out CR/LF? */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
786 ptr1 = ptr2 + 1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
787 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
788 item = q_put2(artist, title, len, time, album, mb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
789 pdebug(fmt_vastr("a[%d]=%s t[%d]=%s l[%d]=%s i[%d]=%s m[%d]=%s b[%d]=%s", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
790 i, I_ARTIST(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
791 i, I_TITLE(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
792 i, I_LEN(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
793 i, I_TIME(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
794 i, I_MB(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
795 i, I_ALBUM(item)), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
796 free(artist); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
797 free(title); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
798 free(len); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
799 free(time); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
800 free(album); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
801 free(mb); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
802 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
803 i++; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
804 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
805 pdebug("Done loading cache.", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
806 free(cache); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
807 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
808 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
809 static void dump_queue(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
810 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
811 FILE *fd; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
812 item_t *item; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
813 char *home, buf[PATH_MAX]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
814 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
815 /*pdebug("Entering dump_queue();", DEBUG);*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
816 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
817 if (!(home = getenv("HOME"))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
818 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
819 pdebug("No HOME directory found. Cannot dump queue.", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
820 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
821 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
822 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
823 snprintf(buf, sizeof(buf), "%s/.audacious/scrobblerqueue.txt", home); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
824 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
825 if (!(fd = fopen(buf, "w"))) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
826 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
827 pdebug(fmt_vastr("Failure opening %s", buf), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
828 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
829 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
830 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
831 pdebug(fmt_vastr("Opening %s", buf), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
832 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
833 q_peekall(1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
834 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
835 while ((item = q_peekall(0))) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
836 fprintf(fd, "%s %s %s %s %s %s\n", |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
837 I_ARTIST(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
838 I_TITLE(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
839 I_LEN(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
840 I_TIME(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
841 I_ALBUM(item), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
842 I_MB(item)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
843 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
844 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
845 fclose(fd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
846 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
847 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
848 /* This was made public */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
849 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
850 void sc_cleaner(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
851 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
852 if(sc_submit_url != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
853 free(sc_submit_url); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
854 if(sc_username != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
855 free(sc_username); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
856 if(sc_password != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
857 free(sc_password); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
858 if(sc_challenge_hash != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
859 free(sc_challenge_hash); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
860 if(sc_srv_res != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
861 free(sc_srv_res); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
862 if(sc_major_error != NULL) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
863 free(sc_major_error); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
864 dump_queue(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
865 q_free(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
866 pdebug("scrobbler shutting down", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
867 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
868 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
869 static void sc_checkhandshake(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
870 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
871 int wait; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
872 |
348
314b7ac7f771
[svn] - handle no account data gracefully (e.g. you only use one of the
nenolod
parents:
344
diff
changeset
|
873 if (!sc_username || !sc_password) |
314b7ac7f771
[svn] - handle no account data gracefully (e.g. you only use one of the
nenolod
parents:
344
diff
changeset
|
874 return; |
314b7ac7f771
[svn] - handle no account data gracefully (e.g. you only use one of the
nenolod
parents:
344
diff
changeset
|
875 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
876 if (sc_hs_status) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
877 return; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
878 if (sc_hs_timeout < time(NULL)) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
879 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
880 sc_handshake(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
881 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
882 if(sc_hs_errors) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
883 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
884 if(sc_hs_errors < 5) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
885 /* Retry after 60 seconds */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
886 wait = 60; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
887 else |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
888 wait = /* sc_submit_interval + */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
889 ( ((sc_hs_errors - 5) < 7) ? |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
890 (60 << (sc_hs_errors-5)) : |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
891 7200 ); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
892 sc_hs_timeout = time(NULL) + wait; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
893 pdebug(fmt_vastr("Error while handshaking. Retrying " |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
894 "after %d seconds.", wait), DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
895 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
896 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
897 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
898 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
899 /**** Public *****/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
900 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
901 /* Called at session startup*/ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
902 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
903 void sc_init(char *uname, char *pwd) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
904 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
905 sc_hs_status = sc_hs_timeout = sc_hs_errors = sc_submit_timeout = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
906 sc_srv_res_size = sc_giveup = sc_major_error_present = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
907 sc_bad_users = sc_sb_errors = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
908 sc_submit_interval = 100; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
909 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
910 sc_submit_url = sc_username = sc_password = sc_srv_res = |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
911 sc_challenge_hash = sc_major_error = NULL; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
912 sc_username = strdup(uname); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
913 sc_password = strdup(pwd); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
914 read_cache(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
915 pdebug("scrobbler starting up", DEBUG); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
916 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
917 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
918 void sc_addentry(GMutex *mutex, TitleInput *tuple, int len) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
919 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
920 g_mutex_lock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
921 q_put(tuple, len); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
922 /* |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
923 * This will help make sure the queue will be saved on a nasty |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
924 * segfault... |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
925 */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
926 dump_queue(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
927 g_mutex_unlock(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
928 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
929 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
930 /* Call periodically from the plugin */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
931 int sc_idle(GMutex *mutex) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
932 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
933 sc_checkhandshake(); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
934 if (sc_hs_status) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
935 sc_handlequeue(mutex); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
936 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
937 return sc_giveup; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
938 } |