You are looking at the HTML representation of the XML format.
HTML is good for debugging, but is unsuitable for application use.
Specify the format parameter to change the output format.
To see the non HTML representation of the XML format, set format=xml.
See the complete documentation, or API help for more information.
<?xml version="1.0"?>
<api>
  <query-continue>
    <allpages gapcontinue="Ruby" />
  </query-continue>
  <query>
    <pages>
      <page pageid="1410" ns="0" title="Remote controlling via CGI Scripts">
        <revisions>
          <rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">=Basic Concept=
I love my chumby, especially to listen to internet radio streams. But I hate to manipulate the device &quot;by hand&quot; to change a station or turn down the volume. Here are some simple cgi scripts to remote control your chumby. Basically, we're manipulating the control panel as described [http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Sending_events_to_the_Control_Panel here] via some cgi-scripts: [http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Built_in_web_server Built-in webserver]. Alternatively, we can manipulate &lt;code&gt;/proc&lt;/code&gt; or could call existing shell scripts.

Put the scripts in /psp/cgi-bin and access them via the built-in web server:
 &lt;nowiki&gt;http://&lt;ip.of.your.chumby&gt;/cgi-bin/custom/&lt;name.of.your.script&gt;&lt;/nowiki&gt;

=Sound=
==Setting the volume==
&lt;PRE&gt;
#!/bin/sh                                                                                               
# /psp/cgi-bin/setvol                                                                                   
# needs volume as parameter between 0 and 100                                                           
# e.g. http://&lt;ip.of.you.chumby/cgi-bin/custom/setvol?30
#                                           
echo &quot;HTTP/1.1 200 ok&quot;                                                                                  
echo &quot;Content-type:  text/html&quot;                                                                         
echo &quot;&lt;event type=\&quot;MusicPlayer\&quot; value=\&quot;setVolume\&quot; comment=\&quot;${QUERY_STRING}\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
echo &quot;&quot;                                                                                                 
chumbyflashplayer.x -F1 &gt; /dev/null 2&gt;&amp;1                                                                
echo &quot;Volume set to ${QUERY_STRING}&quot;     
&lt;/PRE&gt;

NB: Make sure you escape any quotation marks when echoing them in your script.

==Muting==
&lt;PRE&gt;
#!/bin/sh
echo &quot;HTTP/1.1 200 ok&quot;
echo &quot;Content-type:  text/html&quot;
echo &quot;&lt;event type=\&quot;MusicPlayer\&quot; value=\&quot;setMute\&quot; comment=\&quot;on\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
chumbyflashplayer.x -F1
&lt;/PRE&gt;

Unmute with &lt;code&gt;comment=&quot;off&quot;&lt;/code&gt;

==soma.fm==
quick and dirty - just give it the name of your stream (groovesalad|secretagent|lush|digitalis|beatblender|...) as a parameter
&lt;PRE&gt;
#!/bin/sh
echo &quot;HTTP/1.1 200 ok&quot;
echo &quot;Content-type:  text/html&quot;
echo &quot;&quot;
wget -c http://somafm.com/startstream=fw/${QUERY_STRING}.pls -O /tmp/${QUERY_STRING}.pls
MYFILE=`grep File1= /tmp/${QUERY_STRING}.pls | cut -d &quot;=&quot; -f2`
echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;${MYFILE}\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
chumbyflashplayer.x -F1 &gt; /dev/null 2&gt;&amp;1       
echo &quot;&quot;
echo &quot;&quot;     
echo &quot;Now playing ${MYFILE}&quot;
rm /tmp/${QUERY_STRING}.pls
&lt;/PRE&gt;

==shoutcast stream==
Simple example to start a specific shoutcast stream:
&lt;PRE&gt;
#!/bin/sh
echo &quot;HTTP/1.1 200 ok&quot;
echo &quot;Content-type:  text/html&quot;
echo &quot;&quot;
echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://kexp-mp3-2.cac.washington.edu:8000/\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
chumbyflashplayer.x -F1 &gt; /dev/null 2&gt;&amp;1
echo &quot;&quot;
echo &quot;&quot;
echo &quot;Now playing KEXP 128k&quot;
&lt;/PRE&gt;

==multiple streams from one file==
Straightforward example with querystring argument to choose from a variety of streams (or stop the player). Fill in with streams / stream names as you see fit:
&lt;PRE&gt;
#!/bin/sh
echo &quot;HTTP/1.1 200 ok&quot;
echo &quot;Content-type:  text/html&quot;
echo &quot;&quot;
if [ x&quot;${QUERY_STRING}&quot; = xkexp ]; then
        echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://kexp-mp3-2.cac.washington.edu:8000/\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
elif [ x&quot;${QUERY_STRING}&quot; = xkuow ]; then
        echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://128.208.34.80:8002/\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
elif [ x&quot;${QUERY_STRING}&quot; = xstop ]; then
        echo &quot;&lt;event type=\&quot;MusicPlayer\&quot; value=\&quot;stop\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
elif [ x&quot;${QUERY_STRING}&quot; = xindiepop ]; then
        echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://ice.somafm.com/indiepop\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
elif [ x&quot;${QUERY_STRING}&quot; = xdoomed ]; then
        echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://ice.somafm.com/doomed\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
elif [ x&quot;${QUERY_STRING}&quot; = xgroovesalad ]; then
        echo &quot;&lt;event type=\&quot;UserPlayer\&quot; value=\&quot;play\&quot; comment=\&quot;http://ice.somafm.com/groovesalad\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
else
        echo &quot;I don't know the $QUERY_STRING stream - try one of: kexp, kuow, indiepop, doomed, groovesalad, or stop&quot;
fi
chumbyflashplayer.x -F1 &gt; /dev/null 2&gt;&amp;1
echo &quot;&quot;
echo &quot;&quot;
echo &quot;Now playing ${QUERY_STRING}&quot;
&lt;/PRE&gt;

=Dimming the display=
'''Note:''' This does not seem to work on a chumby8.

&lt;code&gt;/proc/sys/sense1/dimlevel&lt;/code&gt; can have different values: 0 is normal, 1 is dimmed, 2 is off. According to [http://wiki.chumby.com/mediawiki/index.php/Chumby_device_settings_information_on_/proc#.2Fproc.2Fsys.2Fsense1.2Fdimlevel], the display can't go from off to dimmed, so when going to the dimmed level, we just always switch to the normal level first and wait for a second.
==dimmed==
&lt;PRE&gt;
#!/bin/sh
echo &quot;HTTP/1.1 200 ok&quot;
echo &quot;Content-type:  text/html&quot;
echo &quot;&quot;
echo 0 &gt; /proc/sys/sense1/dimlevel
sleep 1
echo 1 &gt; /proc/sys/sense1/dimlevel
&lt;/PRE&gt;

==off==
 #!/bin/sh
 echo &quot;HTTP/1.1 200 ok&quot;
 echo &quot;Content-type:  text/html&quot;
 echo &quot;&quot;
 echo 2 &gt; /proc/sys/sense1/dimlevel

=Change the widget=
use &lt;code&gt;nextWidget&lt;/code&gt; or &lt;code&gt;prevWidget&lt;/code&gt; as a value
 #!/bin/sh
 echo &quot;HTTP/1.1 200 ok&quot;
 echo &quot;Content-type:  text/html&quot;
 echo &quot;&quot;
 echo &quot;&lt;event type=\&quot;WidgetPlayer\&quot; value=\&quot;nextWidget\&quot; comment=\&quot;\&quot;/&gt;&quot; &gt; /tmp/flashplayer.event
 chumbyflashplayer.x -F1 &gt; /dev/null 2&gt;&amp;1

=General interface=
Once some of the above scripts are in place, you can create a file named &quot;index&quot; in the same directory, make it executable, and put these contents into that file and you'll have a small remote control for your chumby to control from a phone, laptop, or other device on your network. In this example, I have three chumbies, each with copies of these scripts in cgi-bin.  The link at the top lets me change between the three.  I also have a couple links to start some specific streaming radio stations (player_kexp and player_kuow).
&lt;pre&gt;
&lt;nowiki&gt;
 #!/bin/sh
 echo &quot;HTTP/1.1 200 ok&quot;
 echo &quot;Content-type:  text/html&quot;
 echo &quot;&quot;
 echo &quot;&lt;body style='background-color:666666; color:white'&gt;&quot;
 echo &quot;&lt;center&gt;&quot;
 echo &quot;&lt;h1&gt;Chumby &lt;a href='http://192.168.1.122/cgi-bin/custom/index'&gt;Classic&lt;/a&gt;, &lt;a href='http://192.168.1.123/cgi-bin/custom/index'&gt;Black8&lt;/a&gt;,  &lt;a href='http://192.168.1.124/cgi-bin/custom/index'&gt;Red8&lt;/a&gt;&lt;/h1&gt;&quot;
 echo &quot;volume: &lt;a href='player_setvol?20'&gt;20&lt;/a&gt;, &lt;a href='player_setvol?40'&gt;40&lt;/a&gt;, &lt;a href='player_setvol?60'&gt;60&lt;/a&gt;, &lt;a href='player_setvol?80'&gt;80&lt;/a&gt;, &lt;a href='player_setvol?100'&gt;100&lt;/a&gt;&lt;br&gt;&quot;
 echo &quot;mute: &lt;a href='player_setmute?on'&gt;on&lt;/a&gt;, &lt;a href='player_setmute?off'&gt;off&lt;/a&gt;&lt;br&gt;&quot;
 echo &quot;play: &lt;a href='player_kexp'&gt;kexp&lt;/a&gt;, &lt;a href='player_kuow'&gt;kuow&lt;/a&gt;, &lt;a href='player_stop'&gt;stop&lt;/a&gt;&lt;br&gt;&quot;
 echo &quot;display: &lt;a href='display_off'&gt;off&lt;/a&gt;, &lt;a href='display_dim'&gt;dimmed&lt;/a&gt;, &lt;a href='display_normal'&gt;normal&lt;/a&gt;&quot;
 echo &quot;&lt;/center&gt;&quot;
 echo &quot;&lt;/body&gt;&quot;
 echo &quot;&quot;
&lt;/nowiki&gt;
&lt;/pre&gt;</rev>
        </revisions>
      </page>
      <page pageid="1375" ns="0" title="RootTools">
        <revisions>
          <rev contentformat="text/x-wiki" contentmodel="wikitext" xml:space="preserve">Sometimes tools are needed to help with diagnosing of problems when writing configuration widgets that send data, or widgets that get data from the Chumby network.  Here are two simple tools that can help.

=The Tools=
==RootExaminer==

A simple widget that dumps out the properties of '''_root'''.  Useful to see what values you can get from servers, or from your configuration widget.  Substitute for the widget you are working on.  You can also use this as a configuration widget to see what the servers set as properties of _root.

* NOTE: it is an exercise for the reader to extend it to scroll.

==Configurator== 

A configuration widget that sets and retrieves data from the server.  The user can set or edit any 'name=value' of their choosing.  The widget under development will get these values in their root timeline.  Enter your name=value pairs on each line of its own.

* NOTE this widget also doesn't scroll, but at least it has a button!

=Building=
These widgets were built using mtasc and swfmill on a Linux system.  swfmill and mtasc are also available for other platforms, so it wouldn't be difficult to build it under other platforms.  Shell scripts are included with the commands necessary to build them.

=Download= 

The code and widgets and be found [http://www.webbastards.com/projects/chumby/RootTools.tgz here].  This code is under BSD license except for the parts written by Chumby industries.

=Comments?= 

Please make your comments on the Chumby forums.</rev>
        </revisions>
      </page>
    </pages>
  </query>
</api>