diff options
author | waker <wakeroid@gmail.com> | 2012-05-07 23:36:10 +0200 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2012-05-07 23:36:10 +0200 |
commit | 03e11849011b59026b4a54faf09838ef4718405c (patch) | |
tree | ff47e52642349675885d18c123fabfcb929b9738 | |
parent | bd05ff65490e29de6c75451f9dd6437dd770efe0 (diff) |
fixed loading remote playlists with unknown size
-rw-r--r-- | plugins/vfs_curl/vfs_curl.c | 2 | ||||
-rw-r--r-- | streamer.c | 9 |
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); @@ -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 (); |