Mercurial > audlegacy-plugins
comparison src/scrobbler/plugin.c @ 719:be03e09c7c20 trunk
[svn] - always bail on http streams
| author | nenolod |
|---|---|
| date | Sat, 24 Feb 2007 10:57:24 -0800 |
| parents | 45c9130027d9 |
| children | c380f078aa26 |
comparison
equal
deleted
inserted
replaced
| 718:d252f02a9beb | 719:be03e09c7c20 |
|---|---|
| 10 #include <audacious/plugin.h> | 10 #include <audacious/plugin.h> |
| 11 #include <audacious/ui_preferences.h> | 11 #include <audacious/ui_preferences.h> |
| 12 #include <audacious/playlist.h> | 12 #include <audacious/playlist.h> |
| 13 #include <audacious/configdb.h> | 13 #include <audacious/configdb.h> |
| 14 #include <audacious/beepctrl.h> | 14 #include <audacious/beepctrl.h> |
| 15 #include <audacious/strings.h> | |
| 15 | 16 |
| 16 #include <unistd.h> | 17 #include <unistd.h> |
| 17 #include <stdio.h> | 18 #include <stdio.h> |
| 18 #include <stdlib.h> | 19 #include <stdlib.h> |
| 19 #include <string.h> | 20 #include <string.h> |
| 203 hatena_sc_cleaner(); | 204 hatena_sc_cleaner(); |
| 204 } | 205 } |
| 205 | 206 |
| 206 static char ishttp(const char *a) | 207 static char ishttp(const char *a) |
| 207 { | 208 { |
| 208 char *tmp, *bp; | 209 return str_has_prefix_nocase(a, "http://"); |
| 209 int status = 0; | |
| 210 | |
| 211 if (!a || !*a) | |
| 212 return 0; | |
| 213 | |
| 214 tmp = strdup(a); | |
| 215 for (bp = tmp; *bp; bp++) | |
| 216 *bp = toupper((int) *bp); | |
| 217 if (strstr(tmp, "HTTP://")) | |
| 218 status = -1; | |
| 219 free(tmp); | |
| 220 return status; | |
| 221 } | 210 } |
| 222 | 211 |
| 223 /* Following code thanks to nosuke | 212 /* Following code thanks to nosuke |
| 224 * | 213 * |
| 225 * It should probably be cleaned up | 214 * It should probably be cleaned up |
| 252 | 241 |
| 253 /* current music number */ | 242 /* current music number */ |
| 254 pos_c = xmms_remote_get_playlist_pos(XS_CS); | 243 pos_c = xmms_remote_get_playlist_pos(XS_CS); |
| 255 /* current file name */ | 244 /* current file name */ |
| 256 file_c = xmms_remote_get_playlist_file(XS_CS, pos_c); | 245 file_c = xmms_remote_get_playlist_file(XS_CS, pos_c); |
| 246 | |
| 247 if (ishttp(file_c)) | |
| 248 return dosubmit; | |
| 249 | |
| 257 /* total number */ | 250 /* total number */ |
| 258 playlistlen_c = xmms_remote_get_playlist_length(XS_CS); | 251 playlistlen_c = xmms_remote_get_playlist_length(XS_CS); |
| 259 /* current playtime */ | 252 /* current playtime */ |
| 260 playtime_c = xmms_remote_get_output_time(XS_CS); | 253 playtime_c = xmms_remote_get_output_time(XS_CS); |
| 261 /* total length */ | 254 /* total length */ |
