Topic: My stream config file over http

Hi,
Because I dont feel very confortable with editing My stream radio with the keyboard of the chumby and also because I would like to had radio I found when I am at work and so on... I want to be able to update the config file that set the list of My Stream radio on the chumby. Where is located this file?

thx,

Alex

Re: My stream config file over http

The data is kept in the XML file "/psp/url_streams".

Re: My stream config file over http

Nice, that's work. And is there a way to synchronize it with the account, to dont loose the data or is it a file that stay.... ?

Re: My stream config file over http

It's stored locally - we don't save or sync it on the server.

When you do edit the file, be sure to do the command "sync" - that makes sure the data is written to the storage (instead of just sitting in the filesystem cache).

Re: My stream config file over http

Thanks ;-) What would be the best script language to make a cgi app. Because I tried python cgi and it's slow like hell. Bash I am not so fanatic about it... Is there something else fast enough?

Re: My stream config file over http

There's a version of Perl in the device.

Re: My stream config file over http

Perfect, I just have to learn Perl now tongue Also I was thinking to do most of the work on the web client with Javascript. That will be even easier to manipulate XML and so on. But still may I should try to play a bit with Perl...

Thx ;-)

Re: My stream config file over http

If you like doing stuff in Javascript, there's a version of "node.js" that I ported to the device - there's a link in this forum section.  It's  a pretty fun way to make these sorts of things.

Re: My stream config file over http

Thx ;-) I am just right now front a problem. I want to run a radio with the following command but doesnt work: <event type="UserPlayer" value="play" comment="http://www.radio.com/playlist.pls"/>

Do you have an idea?

Re: My stream config file over http

Also when I have updated my url_stream file how can I refresh the UI of the chumby to display the new radio?

Re: My stream config file over http

The "User Player" takes a URL to a stream, not a playlist.

There currently isn't a CP event to force a reload of the "/psp/url_streams" file - I'll add that.

EDIT: From the code, it looks like if you exit "My Streams" and renter it, the new stuff you added should show up in the list.

Re: My stream config file over http

Yeah, I already noticed it. I just wanted something refresh it automaticaly :-)

To come back to <event type="UserPlayer" value="play" comment="http://www.radio.com/playlist.pls"/> playlist is a stream...

May be you can give an example.

Re: My stream config file over http

A playlist is just a text file that contains a list of URLs to the actual streams.

Download a PLS file and take a look inside.  You should be able to stream one of the URLs in the file.

Re: My stream config file over http

Because you help me a lot, the minimum is to share my code. Finally I only used bash script because my chumby classic is slow like hell and also because then I dont need a dongle usb :-) So you just have to create the following file in the folder /psp/cgi-bin and to give them the executable flag (chmod +x file). The Javascript part is on my public dropbox, it's the main part of this application.

/psp/cgi-bin/player

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type:  text/html"
echo ""
echo "<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.min.js'></script>"
echo "<script type='Text/javascript' src='http://dl.dropbox.com/u/30225532/chumby/chum.js'>"
echo "</script>"
echo "<h1>Chumby</h1>"
echo "<h2>Player</h2>"
echo "<button id='stop_player'>Stop</button>"
echo "<select id='volume_player'><option>Select volume</option></select>"

echo "<h2>Streams</h2>"
streams_xml=`cat /psp/url_streams`
echo "<input id='streams_xml' value='$streams_xml' type='hidden' />"
echo "<div id='streams'></div>"
echo "<button id='add_stream'>Add</button>"
echo "<button id='save_stream'>Save</button>"

/psp/cgi-bin/event

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type:  text/html"
echo ""
echo "${QUERY_STRING}" | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e > /tmp/flashplayer.event
echo "<pre>"
chumbyflashplayer.x -F1
echo "</pre>"

/psp/cgi-bin/save_streams

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type:  text/html"
echo ""
cp /psp/url_streams /psp/url_streams.$(/bin/date +%Y-%m-%d-%H.%M.%S).bak
echo "${QUERY_STRING}" | sed -e's/%\([0-9A-F][0-9A-F]\)/\\\\\x\1/g' | xargs echo -e > /psp/url_streams

What's left to do (but I will not do it cause I am lazy tongue)
There is a problem if the url contain a &, after what, jquery dont manage to parse the XML. I guess I would have to replace all & by &and; or something like that.
Would be nice also to have some CSS.
The button play doesn't work and I dont know enough bash programming to do it (no time to find out...).

That would be really great to have something like this by default on the chumby or on the personal dashborad from chumby.com.

Enjoy, Alex

(This script are not really safe if your chumby is directly accessible from outside your network but in 1 side it's only a chumby so and not so much can happen !!)

Re: My stream config file over http

Also, like you see in the file save_streams, I make a backup of the url_streams file. You should sometime cleanup your folder /psp/ or comment this line or add another command the keep only the 5 last backup or so...

Re: My stream config file over http

My Chumby8 arrived today<thx Woot!>. I was able to copy the /psp/url_streams off of my chumby1 and onto my Ubuntu laptop and then onto the chumby8's /psp/ folder. Opened up "My Streams" and all my entries were there.

Now I can edit my url_streams file and push it to which ever chumby I want.