ref: 00e38f8a6564fa92cc93e30b4ff8726312b1c95e
parent: c2e6a93c29408190695767721a79a5dc252722e8
author: robs <robs>
date: Mon Mar 30 05:47:35 EDT 2009
Support more shoutcast url types
--- a/ChangeLog
+++ b/ChangeLog
@@ -117,6 +117,7 @@
option (where supported).
o [2003121] In many cases, no longer need to specify -t when inputting
audio from a `pipe'. (robs)
+ o Support Shoutcast more URL variants. (robs)
Other bug fixes:
--- a/src/formats.c
+++ b/src/formats.c
@@ -946,15 +946,37 @@
return str_len >= end_len && !strcasecmp(str + str_len - end_len, end);
}
+typedef enum {None, M3u, Pls} playlist_t;
+
+static playlist_t playlist_type(char const * filename)
+{
+ char * x, * p;
+ playlist_t result = None;
+
+ if (*filename == '|')
+ return result;
+ if (strcaseends(filename, ".m3u"))
+ return M3u;
+ if (strcaseends(filename, ".pls"))
+ return Pls;
+ x = lsx_strdup(filename);
+ p = strrchr(x, '?');
+ if (p) {
+ *p = '\0';
+ result = playlist_type(x);
+ }
+ free(x);
+ return result;
+}
+
sox_bool sox_is_playlist(char const * filename)
{
- return *filename != '|' &&
- (strcaseends(filename, ".m3u") || strcaseends(filename, ".pls"));
+ return playlist_type(filename) != None;
}
int sox_parse_playlist(sox_playlist_callback_t callback, void * p, char const * const listname)
{
- sox_bool const is_pls = strcaseends(listname, ".pls");
+ sox_bool const is_pls = playlist_type(listname) == Pls;
int const comment_char = "#;"[is_pls];
size_t text_length = 100;
char * text = lsx_malloc(text_length + 1);