cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Using cURL to keep saving streams

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 16 Apr 2011 23:35:27 +0200 (CEST)

On Wed, 13 Apr 2011, Kristian Kjeldsen wrote:

> I'm finding a new use for cURL(MacOSX) recently and that is saving shoutcast
> streams with low resource load. The commandline i'm using is this: curl -L
> -C - -o session_MMDD.mp3 http://88.198.133.16:8024 And it works great!
> However, at times the stream stops sending data, and sometimes does not
> recover from this condition.

AFAIR, these servers expect the client to notice that it runs out of data to
playback and then the client needs to reconnect and get more data again.

> My question is this: How to, preferably in a single line, have curl save its
> data to the same file and keep reconnecting when there is a problem?

What about something like...

$ while true; curl -C - -L -o session_MMDD.mp3 [URL] -y 100 -Y 10; done

The logic being that if the data stream turns out too slow during 10 seconds,
it'll give up and the shell loop will kick in and reconnect and do another
request.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ:        http://curl.haxx.se/docs/faq.html
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-16