summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2012-05-07 23:36:10 +0200
committerGravatar waker <wakeroid@gmail.com>2012-05-07 23:36:10 +0200
commit03e11849011b59026b4a54faf09838ef4718405c (patch)
treeff47e52642349675885d18c123fabfcb929b9738
parentbd05ff65490e29de6c75451f9dd6437dd770efe0 (diff)
fixed loading remote playlists with unknown size
-rw-r--r--plugins/vfs_curl/vfs_curl.c2
-rw-r--r--streamer.c9
2 files changed, 8 insertions, 3 deletions
diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c
index b0779da7..bf35b7f4 100644
--- a/plugins/vfs_curl/vfs_curl.c
+++ b/plugins/vfs_curl/vfs_curl.c
@@ -652,6 +652,7 @@ http_thread_func (void *ctx) {
trace ("curl error:\n%s\n", fp->http_err);
}
deadbeef->mutex_lock (fp->mutex);
+#if 0
if (status == 0 && fp->length < 0 && fp->status != STATUS_ABORTED && fp->status != STATUS_SEEK) {
trace ("vfs_curl: restarting stream\n");
// NOTE: don't do http_stream_reset here - we don't want to cut the ending
@@ -669,6 +670,7 @@ http_thread_func (void *ctx) {
deadbeef->mutex_unlock (fp->mutex);
continue;
}
+#endif
if (fp->status != STATUS_SEEK) {
trace ("vfs_curl: break loop\n");
deadbeef->mutex_unlock (fp->mutex);
diff --git a/streamer.c b/streamer.c
index ce381dee..5da0d08f 100644
--- a/streamer.c
+++ b/streamer.c
@@ -755,8 +755,9 @@ streamer_set_current (playItem_t *it) {
trace ("failed to alloc %d bytes for playlist buffer\n");
goto m3u_error;
}
+ trace ("reading %d bytes\n", size);
int rd = vfs_fread (buf, 1, size, fp);
- if (rd != size) {
+ if (rd <= 0) {
trace ("failed to download %d bytes (got %d bytes)\n", size, rd);
goto m3u_error;
}
@@ -772,13 +773,14 @@ streamer_set_current (playItem_t *it) {
trace ("failed to open temp file %s\n", tempfile);
goto m3u_error;
}
+ trace ("writing to %s\n", tempfile);
out = fdopen (fd, "w+b");
if (!out) {
trace ("fdopen failed for %s\n", tempfile);
goto m3u_error;
}
- int rw = fwrite (buf, 1, size, out);
- if (rw != size) {
+ int rw = fwrite (buf, 1, rd, out);
+ if (rw != rd) {
trace ("failed to write %d bytes into file %s\n", size, tempfile);
goto m3u_error;
}
@@ -786,6 +788,7 @@ streamer_set_current (playItem_t *it) {
fd = -1;
out = NULL;
+ trace ("loading playlist from %s\n", tempfile);
// load playlist
playlist_t *plt = plt_alloc ("temp");
DB_playlist_t **plug = plug_get_playlist_list ();