Enigma2:WebInterface

Aus TuxBoxWIKI
Version vom 13. Februar 2009, 15:48 Uhr von Dbt (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Wechseln zu: Navigation, Suche


General

With the Webinterface you can Control your Box using a Browser. The Dreambox Webinterface (short WebIf) is included in all newer Images. The latest version of the WebIf can be obtained via CVS. You can also use the Webinterface API in your 3rd Party Applications to control the box or display information.

You can reach the WebIf by pointing your Browser to the IP if your Box (e.g. 192.168.0.21), or if name resolution works by calling http://dreambox.

Technical

The Webinterface is fully embedded into enigma2. It is able to use ANY functionality and obtain ANY Information enigma2 can deliver.

Concept

The Webinterface works with a Client-/Server based Concept. The Webinterface Plugin provides you with 2 Major things.

  1. A Client API which you can access with any client (html/javascript, c++, java) you want to
    1. Control your Box and obtain Information for Channels (EPG, Timers, Recorded Movies, etc)
    2. Results are returned as xml
  2. A http client you can use with your browser

Live Updates

One of the major Improvements compared to the Webinterface of enigma1 is the Live-Update functionality. Changes can be automatically delivered to the webinterface without polling the server or reloading the whole page. This is realized by using a never ending Connection which is used to execute the DOM-Manipulation cmds.

<script>parent.set("CurrentTime", "19:46:32");</script>
<script>parent.set("CurrentService", Channelname(19.2?E)");</script>
<script>parent.set("Event_Now_Name", "Name of Current event");</script>
<script>parent.set("Event_Now_Extended_Description", "Extended description of current event");</script>
<script>parent.set("Event_Now_Begin", "19:40");</script>
<script>parent.set("Event_Now_Remaining", "+28 min");</script>
<script>parent.set("Event_Next_Name", "Name of next Event");</script>
<script>parent.set("Event_Next_Begin", "20:15");</script>
<script>parent.set("Event_Next_Remaining", "60 min");</script>
<script>parent.set("Event_Next_Extended_Description", "Extendes description of next event");</script>

Client API

The API can be used by making http requests to your Box. As described above every request will usually result in a valid xml response.

Box General Info

  • http://IP_of_your_box/web/about

Or via Telnet use at the Telnet prompt:

  • wget -q -O - http://127.0.0.1/web/about

Result is (here a DM800 / no HDD):

<?xml version="1.0" encoding="UTF-8"?>
<e2abouts>
   <e2about>
       <e2enigmaversion>dev-2008-05-19</e2enigmaversion>
       <e2landhcp>True</e2landhcp>
       <e2lanip>10.101.98.94</e2lanip>
       <e2lanmask>255.255.255.0</e2lanmask>
       <e2langw>10.101.98.1</e2langw>
  
       <e2fpversion>?</e2fpversion>
       <e2webifversion>Beta 0.98.5</e2webifversion>
       <e2tunerinfo>
               <e2nim>
                      <name>Tuner A</name>
                      <type> Alps BSBE2 (DVB-S2)</type>
               </e2nim></e2tunerinfo>
        <e2hddinfo>
               <model>N/A</model>
               <capacity>-</capacity>
               <free>-</free></e2hddinfo>
   
        <e2servicename>Das Erste</e2servicename>
        <e2serviceprovider>ARD  </e2serviceprovider>
        <e2serviceaspect>4:3</e2serviceaspect>
        <e2servicevideosize>-1x-1</e2servicevideosize>
        <e2servicenamespace>0xc00000</e2servicenamespace>
   
        <e2vpid>101</e2vpid>
        <e2apid>102</e2apid>
        <e2pcrid>101</e2pcrid>
        <e2pmtpid>100</e2pmtpid>
        <e2txtpid>104</e2txtpid>
        <e2tsid>1101</e2tsid>
        <e2onid>1</e2onid>
        <e2sid>28106</e2sid>
    </e2about>
</e2abouts>


Volume

Requests:

Result:

<?xml version="1.0" encoding="utf-8"?>
<e2volume>
   <e2result>True</e2result>
   <e2resulttext>state</e2resulttext>
   <e2current>5</e2current>
   <e2ismuted>False</e2ismuted>	
</e2volume>

Parameter:

result = True if command successful, False otherwise
resulttext = textbased description of what succeeded/went wrong
current = current Volume - Value between 0 and 100
ismuted = True if muted, False if not

Audio Tracks

Displays the available audio tracks of the current service

Request:

  • http://IP_of_your_box/web/getaudiotracks

or via Telnet:

  • wget -q -O - http://127.0.0.1/web/getaudiotracks

Result:

<?xml version="1.0" encoding="UTF-8"?>
<e2audiotracklist>
               <e2audiotrack>
                       <e2audiotrackdescription>MPEG (Stereo)</e2audiotrackdescription>
                       <e2audiotrackid>0</e2audiotrackid>
                       <e2audiotrackpid>120</e2audiotrackpid>
                       <e2audiotrackactive>True</e2audiotrackactive>
               </e2audiotrack>

               <e2audiotrack>
                       <e2audiotrackdescription>MPEG (mono/Hörfilm)</e2audiotrackdescription>
                       <e2audiotrackid>1</e2audiotrackid>
                       <e2audiotrackpid>121</e2audiotrackpid>
                       <e2audiotrackactive>False</e2audiotrackactive>
               </e2audiotrack>

               <e2audiotrack>
                       <e2audiotrackdescription>AC3 (Dolby Digital)</e2audiotrackdescription>
                       <e2audiotrackid>2</e2audiotrackid>
                       <e2audiotrackpid>125</e2audiotrackpid>
                       <e2audiotrackactive>False</e2audiotrackactive>
               </e2audiotrack>

</e2audiotracklist>

To select a specific audio track you first have to find out its id via the "getaudiotracks" command. Then use the id as a parameter on this command:

Request:

  • http://IP_of_your_box/web/selectaudiotrack?id=2

or via Telnet:

  • wget -q -O - http://127.0.0.1/web/selectaudiotrack?id=2

Result:

<?xml version="1.0" encoding="UTF-8"?>
<e2result>Success</e2result>

In case you issued an invalid (non-existing) id you get this result:

<?xml version="1.0" encoding="UTF-8"?>
<e2result>Error</e2result>


EPG

Requests:

Timer

Requests:

Message

Requests:

Parameter:

messagetext=Text of Message
messagetype=Number from 0 to 3, 0= Yes/No, 1= Info, 2=Message, 3=Attention
timeout=Can be empty or the Number of seconds the Message should disappear after.

Result:

<e2message>
   <e2result>True</e2result>
   <e2resulttext>Message send to screen</e2resulttext>
</e2message>

Requests:

Result:

<e2message>
   <e2result>True</e2result>
   <e2resulttext>Answer is (YES|NO)!</e2resulttext>
</e2message>

RemoteControl

Requests:

Settings

Requests:

Result:

<e2settings>
   <e2setting>
      <e2settingvalue>0</e2settingvalue>
      <e2settingname>config.recording.margin_before</e2settingname>
   </e2setting
   <e2setting>
      <e2settingvalue>0</e2settingvalue>
      <e2settingname>config.recording.margin_after</e2settingname>
   </e2setting>
</e2settings>

Bouquets

Requests:

  • http://dreambox/web/getservices?ServiceListBrowse= ' plus encoded serviceref

...anybody knows what the result looks like...?

  • http://IP_of_your_box/web/getservices

or via Telnet:

  • wget -q -O - http://127.0.0.1/web/getservices

Result (more than one bouquet assumed):

<?xml version="1.0" encoding="UTF-8"?>
 <e2servicelist>
    <e2service>
         <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.dbe00.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>Normal</e2servicename>
    </e2service>
    <e2service>
          <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.dbe04.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>Premiere</e2servicename>
     </e2service>
     <e2service>
          <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.dbe01.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>Sport+News</e2servicename>
     </e2service>
     <e2service>
          <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.dbe02.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>Kinder+Music</e2servicename>
     </e2service>
     <e2service>
          <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.dbe03.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>HD</e2servicename>
     </e2service>
     <e2service>
          <e2servicereference>1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet</e2servicereference>
          <e2servicename>Favourites (TV)</e2servicename>
     </e2service>
</e2servicelist>

The services within a bouquet are requested by specifying the service reference. The service reference of the last bouquet from above is:

1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet

so the request is:

  • http://IP_of_your_box/web/getservices?sRef=1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet

or via Telnet (replace all spaces with %20 and the " with %22):

  • wget -q -O - http://127.0.0.1/web/getservices?sRef=1:7:1:0:0:0:0:0:0:0:FROM%20BOUQUET%20%22userbouquet.favourites.tv%22%20ORDER%20BY%20bouquet

Result is:

<?xml version="1.0" encoding="UTF-8"?>
<e2servicelist>
   <e2service>
      <e2servicereference>1:0:1:6DCA:44D:1:C00000:0:0:0:</e2servicereference>
      <e2servicename>Das Erste</e2servicename>
   </e2service>
   <e2service>
      <e2servicereference>1:0:1:6D66:437:1:C00000:0:0:0:</e2servicereference>
      <e2servicename>ZDF</e2servicename>
   </e2service>
   <e2service>
      <e2servicereference>1:0:1:6D67:437:1:C00000:0:0:0:</e2servicereference>
      <e2servicename>3sat</e2servicename>
   </e2service>
   <e2service>
      <e2servicereference>1:0:1:445C:453:1:C00000:0:0:0:</e2servicereference>
      <e2servicename>SAT.1</e2servicename>
   </e2service>
   ...
</e2servicelist>

If there are headers within the bouquet an <e2service> entry looks like this:

<e2service>
    <e2servicereference>1:64:A:0:0:0:0:0:0:0::Premiere-Star---Astra(19.2E)---------------------------------------------------------</e2servicereference>
    <e2servicename>Premiere-Star---Astra(19.2E)---------------------------------------------------------</e2servicename>
</e2service>

reload lamedb or Userbouquets

Requests:

Mode can be:

  • 0, reloading lamedb and Userbouquets
  • 1, reloading lamedb only
  • 2, reloading Userbouquets only

Result of mode=1:

<e2message>
   <e2result>true</e2result>
   <e2resulttext>reloaded lamedb</e2resulttext>
</e2message>
  • e2result, true or false
  • e2resulttext: contains strings with errortext if failed, in the other case the successfull command

Zap

Request:

or via Telnet (this one switches to Anixe HD):

Result:

 <rootElement></rootElement>

Issuing an invalid servicereference will get you the same result...

Streaming

Request:

Current Channel

Requests:

Result:

<?xml version="1.0" encoding="UTF-8"?>
<e2servicelist>
   <e2service>
       <e2servicereference>1:0:1:335:9DD0:7E:820000:0:0:0:</e2servicereference>
       <e2servicename>M6 Suisse</e2servicename>
   </e2service>   
</e2servicelist>

Miscellaneous

Requests:

Links