push stream to mp3
Posted: Fri Apr 20, 2007 12:29 pm
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 ;-)
#!/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 ;-)