a very quick hack ... ;-) but it works...
#!/usr/bin/newlisp
;;
;; save streaming music to local file.mp3
;; enjoy nodep (2) 2006
;;
;; some playlist..raw hack..
(setq playlist (read-file "http://www.garnierstreamingmedia.com/asx/kinkfm.pls"))
;; returns -> "[playlist]\r\nNumberOfEntries=1\r\nFile1=http://81.173.3.20:80/\r\n"
(regex "=http://(.*):(.*)/\r\n" playlist)
(setq link (net-connect (string $1) (int $2) ))
;; any playlist, thisone have no additional path, else add PATH to the GET
(net-send link "GET / HTTP/1.0\r\n")
;; ICY
(net-send link "Icy-MetaData,1\r\n\r\n")
;; semi streaming !
(while (net-peek link)
(net-receive link 'buff 8192) (append-file "x.mp3" buff))
;; need to press ctrl-c to stop this
(exit)
now play with winamp or xmms the x.mp3 file... enjoy..
[edited] now its working ;-)
push stream to mp3
push stream to mp3
-- (define? (Cornflakes))
thanks for the edit/corrections, now it works ;-), I added a little progress indicator:
you could plug in one of your curses routines to make that even nicer
Lutz
Code: Select all
;; semi streaming !
(while (net-peek link)
(print ".")
(net-receive link 'buff 8192)
(append-file "x.mp3" buff))
Lutz
..I always liked these kind of indicators, from the old "DOS' days..
(setq indicator '( {|} {/} {-} {\} ))
;; a very raw hack!
(setq playlist (read-file "http://www.garnierstreamingmedia.com/asx/kinkfm.pls"))
(regex "=http://(.*):(.*)/\r\n" playlist)
(setq link (net-connect (string $1) (int $2) ))
(net-send link "GET / HTTP/1.0\r\n")
(net-send link "Icy-MetaData,1\r\n\r\n")
(while (net-peek link)
(print (first (rotate indicator)) "\027[D")
(sleep 200)
(net-receive link 'buff 8192) (append-file "x.mp3" buff))
(exit)
(setq indicator '( {|} {/} {-} {\} ))
;; a very raw hack!
(setq playlist (read-file "http://www.garnierstreamingmedia.com/asx/kinkfm.pls"))
(regex "=http://(.*):(.*)/\r\n" playlist)
(setq link (net-connect (string $1) (int $2) ))
(net-send link "GET / HTTP/1.0\r\n")
(net-send link "Icy-MetaData,1\r\n\r\n")
(while (net-peek link)
(print (first (rotate indicator)) "\027[D")
(sleep 200)
(net-receive link 'buff 8192) (append-file "x.mp3" buff))
(exit)
-- (define? (Cornflakes))