Mercurial > audlegacy-plugins
diff src/mpg123/http.c @ 218:a6f6309ab0a0 trunk
[svn] - fix for stream save if filename duplicates exist
| author | yaz |
|---|---|
| date | Sun, 05 Nov 2006 00:34:45 -0800 |
| parents | 3da1b8942b8b |
| children | 1e2d575fd2e7 |
line wrap: on
line diff
--- a/src/mpg123/http.c Sat Nov 04 23:03:45 2006 -0800 +++ b/src/mpg123/http.c Sun Nov 05 00:34:45 2006 -0800 @@ -625,26 +625,27 @@ } while (redirect); if (mpgdec_cfg.save_http_stream) { - gchar *output_name; + gchar *output_name_seed, *output_name; gint i = 1; file = mpgdec_http_get_title(url); - output_name = file; - if (!strncasecmp(output_name, "http://", 7)) - output_name += 7; - temp = strrchr(output_name, '.'); + output_name_seed = file; + if (!strncasecmp(output_name_seed, "http://", 7)) + output_name_seed += 7; + temp = strrchr(output_name_seed, '.'); if (temp && !strcasecmp(temp, ".mp3")) *temp = '\0'; - while ((temp = strchr(output_name, '/'))) + while ((temp = strchr(output_name_seed, '/'))) *temp = '_'; + output_name = g_strdup_printf("%s/%s.mp3", - mpgdec_cfg.save_http_path, output_name); + mpgdec_cfg.save_http_path, output_name_seed); while (!access(output_name, F_OK) && i < 100000) { g_free(output_name); output_name = g_strdup_printf("%s/%s-%d.mp3", mpgdec_cfg.save_http_path, - output_name, i++); + output_name_seed, i++); } g_free(file);
