Results 1 to 3 of 3

Thread: Add additional line in Vortexbox Player GUI

  1. #1
    Member
    Join Date
    Feb 2009
    Location
    Bristol, UK
    Posts
    84

    Add additional line in Vortexbox Player GUI

    Hi all,

    The Vortexbox Player GUI allows for up to 5 players. Could anyone point me to a post that explains how to add an additional line - or advise me how it's done?

    Many thanks

    Brad

  2. #2
    Appologies if this is a bit late. I achieved this by editing:

    /var/www/html/vortexbox-player.php
    /var/www/html/templates/vortexbox-player.tpl

    here are my files:

    Code:
    [vortexbox.localdomain templates]# cat ../vortexbox-player.php
    <?php
    // Copyright (C) 2008 - 2012 vortexbox.org
    //
    // This program is free software; you can redistribute it and/or
    // modify it under the terms of the GNU General Public License
    // as published by the Free Software Foundation; either version 2
    // of the License, or (at your option) any later version.
    //
    // This program is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    require '/var/www/html/libs/Smarty.class.php';
    
    function NotMac($address){
    If(strlen($address) > 17) return 1;
    If($address == "") return 1;
    If (!eregi("^[0-9A-Z]+(\:[0-9A-Z]+)+(\:[0-9A-Z]+)+(\:[0-9A-Z]+)+(\:[0-9A-Z]+)+(\:[0-9A-Z]+)$",$address)) return 1;
    $Array=explode(":",$address);
    If(strlen($Array[0]) != 2) return 1;
    If(strlen($Array[1]) != 2) return 1;
    If(strlen($Array[2]) != 2) return 1;
    If(strlen($Array[3]) != 2) return 1;
    If(strlen($Array[4]) != 2) return 1;
    If(strlen($Array[5]) != 2) return 1;
    If(strlen($Array[6]) != 2) return 1;
    If(strlen($Array[7]) != 2) return 1;
    If(strlen($Array[8]) != 2) return 1;
    If(strlen($Array[9]) != 2) return 1;
    If(strlen($Array[10]) != 2) return 1;
    If(strlen($Array[11]) != 2) return 1;
    If(strlen($Array[12]) != 2) return 1;
    If(strlen($Array[13]) != 2) return 1;
    return 0;
    }
    
    function RandomMac(){
    $RandomMac ="00:04:20:".strtoupper(dechex(rand( 0,255))).":".strtoupper(dechex(rand( 0,255))).":".strtoupper(dechex(rand( 0,255)));
    return $RandomMac;
    }
    
    $smarty = new Smarty;
    $smarty->caching = 0;
    
    $smarty->compile_check = true;
    $smarty->debugging = false;
    
    $configfile = "/var/www/html/config/playergui.cfg";
    
    require '/var/www/html/libs/vortexbox_defs.php';
    require '/var/www/html/libs/vortexbox_smarty.php';
    
    $_action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'default';
    $config = array();
    
    if (file_exists($configfile)) {
        $config = array();
    } else {
    // build default if required
        $config = array( 0 => array ( "DEVICENAME" => "Default", "NAME" => "VortexBox Player", "MAC" => RandomMac(), "softvol_ischecked" => "no" ),
            1 => array ("softvol_ischecked" => "no" ),
            2 => array ("softvol_ischecked" => "no" ),
            3 => array ("softvol_ischecked" => "no" ),
            4 => array ("softvol_ischecked" => "no" ),
            5 => array ("softvol_ischecked" => "no" ),
            6 => array ("softvol_ischecked" => "no" ),
            7 => array ("softvol_ischecked" => "no" ),
            8 => array ("softvol_ischecked" => "no" ),
            9 => array ("softvol_ischecked" => "no" ),
            10 => array ("softvol_ischecked" => "no" ),
            11 => array ("softvol_ischecked" => "no" ),
            12 => array ("softvol_ischecked" => "no" ),
            13 => array ("softvol_ischecked" => "no" ),
            );
            $fp = fopen($configfile,'w');
            fwrite($fp,serialize($config));
            fclose($fp);
    }
    
    switch($_action) {
    
        case 'submit':
    
                    for ( $counter = 0; $counter <= 10 ; $counter++) {
                      if (isset($_REQUEST['DEVICENAME'.$counter]) & !$_REQUEST['DEVICENAME'.$counter] =="") { $config[$counter]['DEVICENAME'] = $_REQUEST['DEVICENAME'.$counter]; }
                      if (isset($_REQUEST['NAME'.$counter]) & !$_REQUEST['NAME'.$counter] =="") { $config[$counter]['NAME'] = $_REQUEST['NAME'.$counter]; }
                      if (isset($_REQUEST['MAC'.$counter]) & !$_REQUEST['MAC'.$counter] =="") { $config[$counter]['MAC'] = strtoupper($_REQUEST['MAC'.$counter]); }
                      if (isset($config[$counter]['NAME']) & isset($_REQUEST['SOFTVOL'.$counter]) & !$_REQUEST['SOFTVOL'.$counter] =="")
                      { $config[$counter]['softvol_ischecked'] = $_REQUEST['SOFTVOL'.$counter][0]; } else {$config[$counter]['softvol_ischecked'] = "no";}
    
                      if (isset($config[$counter]['NAME']) & !isset($config[$counter]['MAC'])) {$config[$counter]['MAC'] = RandomMac(); }
                      if (isset($config[$counter]['MAC']) & NotMac($config[$counter]['MAC'])) {$config[$counter]['MAC'] = RandomMac(); }
                    }
                    $fp = fopen($configfile,'w');
                    fwrite($fp,serialize($config));
                    fclose($fp);
    //restart vortexbox-player
                    exec("sudo /opt/vortexbox/doaction.sh RestartVBplayer & >/dev/null 2>&1");
    
                    break;
            default:
                    $configall = file_get_contents($configfile);
                    $config = unserialize($configall);
    }
    
    $x=0;
    foreach ($config as $devarray) {
      foreach ($devarray as $key => $value) {
       $smarty->assign($key.$x,$value);
      }
    $x++;
    }
    
    $smarty->assign('softvol_checkbox', array(
                                            'softvol' => '',
                         ));
    
    $smarty->assign('CardList', nl2br(str_replace(' ','&nbsp;',file_get_contents('/proc/asound/cards'))));
    $smarty->assign('CardOutputList', nl2br(str_replace(' ','&nbsp;',file_get_contents('/proc/asound/devices'))));
    
    $smarty->display('vortexbox-player.tpl');
    
    ?>

  3. #3
    vortexbox-player.tpl:

    Code:
    {include file="header.tpl"}
    
    <script type="text/javascript" src="/js/ajax.js"> </script>
    
    <div class="xsnazzy">
    <b class="xtop"><b class="xb1"></b><b class="xb2 color_a">
    </b><b class="xb3 color_a"></b><b class="xb4 color_a"></b></b>
    <div class="xboxcontent">
    <h1 class="color_a">Configure VortexBox Player {include file='tooltip.tpl' Name='Configure VortexBox Player' File='vortexbox_player'}</h1>
    <form action="{$SCRIPT_NAME}?action=submit" method="post">
            <div class="texttable">
              <table>
                <tr>
                            <th>Name {include file='tooltip.tpl' Name='VortexBox Player Name' File='vortexbox_player_name'}</th>
                            <th>MAC address {include file='tooltip.tpl' Name='MAC address' File='vortexbox_player_mac'}</th>
                            <th>Audio Device {include file='tooltip.tpl' Name='ALSA audio device' File='vortexbox_player_device'}</th>
                            <th>Soft Vol. {include file='tooltip.tpl' Name='Software Volume Control' File='vortexbox_player_softvol'}</th>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME0" value="{$NAME0}" size="25"></td>
                            <td><input type="text" name="MAC0" value="{$MAC0}" size="15"></td>
                            <td><input type="text" name="DEVICENAME0" value="{$DEVICENAME0}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL0' options=$softvol_checkbox selected=$softvol_ischecked0 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME1" value="{$NAME1}" size="25"></td>
                            <td><input type="text" name="MAC1" value="{$MAC1}" size="15"></td>
                            <td><input type="text" name="DEVICENAME1" value="{$DEVICENAME1}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL1' options=$softvol_checkbox selected=$softvol_ischecked1 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME2" value="{$NAME2}" size="25"></td>
                            <td><input type="text" name="MAC2" value="{$MAC2}" size="15"></td>
                            <td><input type="text" name="DEVICENAME2" value="{$DEVICENAME2}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL2' options=$softvol_checkbox selected=$softvol_ischecked2 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME3" value="{$NAME3}" size="25"></td>
                            <td><input type="text" name="MAC3" value="{$MAC3}" size="15"></td>
                            <td><input type="text" name="DEVICENAME3" value="{$DEVICENAME3}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL3' options=$softvol_checkbox selected=$softvol_ischecked3 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME4" value="{$NAME4}" size="25"></td>
                            <td><input type="text" name="MAC4" value="{$MAC4}" size="15"></td>
                            <td><input type="text" name="DEVICENAME4" value="{$DEVICENAME4}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL4' options=$softvol_checkbox selected=$softvol_ischecked4 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME5" value="{$NAME5}" size="25"></td>
                            <td><input type="text" name="MAC5" value="{$MAC5}" size="15"></td>
                            <td><input type="text" name="DEVICENAME5" value="{$DEVICENAME5}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL5' options=$softvol_checkbox selected=$softvol_ischecked5 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME6" value="{$NAME6}" size="25"></td>
                            <td><input type="text" name="MAC6" value="{$MAC6}" size="15"></td>
                            <td><input type="text" name="DEVICENAME6" value="{$DEVICENAME6}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL6' options=$softvol_checkbox selected=$softvol_ischecked6 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME7" value="{$NAME7}" size="25"></td>
                            <td><input type="text" name="MAC7" value="{$MAC7}" size="15"></td>
                            <td><input type="text" name="DEVICENAME7" value="{$DEVICENAME7}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL7' options=$softvol_checkbox selected=$softvol_ischecked7 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME8" value="{$NAME8}" size="25"></td>
                            <td><input type="text" name="MAC8" value="{$MAC8}" size="15"></td>
                            <td><input type="text" name="DEVICENAME8" value="{$DEVICENAME8}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL8' options=$softvol_checkbox selected=$softvol_ischecked8 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME9" value="{$NAME9}" size="25"></td>
                            <td><input type="text" name="MAC9" value="{$MAC9}" size="15"></td>
                            <td><input type="text" name="DEVICENAME9" value="{$DEVICENAME9}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL9' options=$softvol_checkbox selected=$softvol_ischecked9 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME10" value="{$NAME10}" size="25"></td>
                            <td><input type="text" name="MAC10" value="{$MAC10}" size="15"></td>
                            <td><input type="text" name="DEVICENAME10" value="{$DEVICENAME10}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL10' options=$softvol_checkbox selected=$softvol_ischecked10 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME11" value="{$NAME11}" size="25"></td>
                            <td><input type="text" name="MAC11" value="{$MAC11}" size="15"></td>
                            <td><input type="text" name="DEVICENAME11" value="{$DEVICENAME11}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL11' options=$softvol_checkbox selected=$softvol_ischecked11 }</td>
                    </tr>
                    <tr class="odd">
                            <td><input type="text" name="NAME12" value="{$NAME12}" size="25"></td>
                            <td><input type="text" name="MAC12" value="{$MAC12}" size="15"></td>
                            <td><input type="text" name="DEVICENAME12" value="{$DEVICENAME12}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL12' options=$softvol_checkbox selected=$softvol_ischecked12 }</td>
                    </tr>
                    <tr>
                            <td><input type="text" name="NAME13" value="{$NAME13}" size="25"></td>
                            <td><input type="text" name="MAC13" value="{$MAC13}" size="15"></td>
                            <td><input type="text" name="DEVICENAME13" value="{$DEVICENAME13}" size="15"></td>
                            <td>{html_checkboxes name='SOFTVOL13' options=$softvol_checkbox selected=$softvol_ischecked13 }</td>
                    </tr>
              </table>
             </div>
    <p><input type="submit" value="Submit"></p>
    </form><p></p>
    
    <div>
    <br>
    <b>ALSA device list</b>
    <p font="Courier, monospace;">
    {$CardList}
    </p>
    <br>
    <b>List of audio device ports</b>
    <p font="Courier, monospace;">
    {$CardOutputList}
    </p>
    <br>
    <br>
    
    </div>
    
    <p></p>
    </div>
    <b class="xbottom"><b class="xb4"></b><b class="xb3"></b>
    <b class="xb2"></b><b class="xb1"></b></b>
    </div>
    
    {include file="footer.tpl"}

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •