Пример #1
0
            // replace presentation_url with current IP address
            $line = "presentation_url=http://" . $ip . ":80\n";
        }
        $newArray[] = $line;
    }
    // Commit changes to /run/minidlna.conf
    $fp = fopen($file, 'w');
    fwrite($fp, implode("", $newArray));
    fclose($fp);
    // Start minidlna service
    sysCmd('/usr/bin/minidlna -f /run/minidlna.conf');
}
// check /etc/network/interfaces integrity
hashCFG('check_net', $db);
// check /etc/mpd.conf integrity
hashCFG('check_mpd', $db);
// check /etc/auto.nas integrity
// hashCFG('check_source',$db);
// unlock session files
playerSession('unlock', $db, '', '');
// Cmediafix startup check
if (isset($_SESSION['cmediafix']) && $_SESSION['cmediafix'] == 1) {
    $mpd = openMpdSocket('localhost', 6600);
    sendMpdCommand($mpd, 'cmediafix');
    closeMpdSocket($mpd);
}
// Utilities to start with Volumio
// Shairport for Airplay Capability
//Retrieve Output Device
$dbh = cfgdb_connect($db);
$query_cfg = "SELECT param,value_player FROM cfg_mpd WHERE value_player!=''";
Пример #2
0
        if (isset($_GET['reset']) && $_GET['reset'] == 1) {
            $_SESSION['notify']['msg'] = 'NetConfig restored to default settings';
        } else {
            $_SESSION['notify']['msg'] = 'NetConfig modified';
        }
    } else {
        $_SESSION['notify']['title'] = '';
        $_SESSION['notify']['msg'] = 'Background worker busy';
    }
    // unlock session file
    playerSession('unlock');
}
// wait for worker output if $_SESSION['w_active'] = 1
waitWorker(1);
// check integrity of /etc/network/interfaces
if (!hashCFG('check_net', $db)) {
    $_netconf = file_get_contents('/etc/network/interfaces');
    // set manual config template
    $tpl = "net-config-manual.html";
} else {
    $dbh = cfgdb_connect($db);
    $net = cfgdb_read('cfg_lan', $dbh);
    $wifisec = cfgdb_read('cfg_wifisec', $dbh);
    $dbh = null;
    $ipe = "ip addr list eth0 |grep \"inet \" |cut -d' ' -f6|cut -d/ -f1";
    $ipw = "ip addr list wlan0 |grep \"inet \" |cut -d' ' -f6|cut -d/ -f1";
    $ipeth0 = exec($ipe);
    $ipwlan0 = exec($ipw);
    $spe = "ethtool eth0 | grep -i speed | tr -d 'Speed:'";
    $speth0 = exec($spe);
    //getting signal quality percentage
Пример #3
0
        $_SESSION['w_active'] = 1;
        // set UI notify
        $_SESSION['notify']['title'] = 'MPD Config modified';
        $_SESSION['notify']['msg'] = 'Restarting MPD daemon...';
        session_write_close();
    } else {
        session_start();
        $_SESSION['notify']['title'] = 'Job Failed';
        $_SESSION['notify']['msg'] = 'Background worker is busy.';
        session_write_close();
    }
}
// wait for worker output if $_SESSION['w_active'] = 1
waitWorker(1);
// check integrity of /etc/network/interfaces
if (!hashCFG('check_mpd', $db)) {
    $_mpdconf = file_get_contents('/etc/mpd.conf');
    // set manual config template
    $tpl = "mpd-config-manual.html";
} else {
    $mpdconf = cfgdb_read('', $dbh, 'mpdconf');
    // prepare array
    $_mpd = array('port' => '', 'gapless_mp3_playback' => '', 'auto_update' => '', 'samplerate_converter' => '', 'auto_update_depth' => '', 'zeroconf_enabled' => '', 'zeroconf_name' => '', 'audio_output_format' => '', 'mixer_type' => '', 'audio_buffer_size' => '', 'buffer_before_play' => '', 'dop' => '', 'device' => '', 'volume_normalization' => '');
    //debug($mpdconf);
    // parse output for template $_mpdconf
    foreach ($mpdconf as $key => $value) {
        foreach ($_mpd as $key2 => $value2) {
            if ($value['param'] == $key2) {
                $_mpd[$key2] = $value['value_player'];
            }
        }
Пример #4
0
    // reset MPD configuration
    if (isset($_POST['reset'])) {
        $jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'mpdcfg', 'action' => 'reset'));
    }
    // update MPD configuration
    if (isset($_POST['conf'])) {
        $jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'mpdcfg', 'action' => 'update', 'args' => $_POST['conf']));
    }
    // manual MPD configuration
    if (isset($_POST['mpdconf'])) {
        $jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'mpdcfgman', 'args' => $_POST['mpdconf']));
    }
}
waitSyWrk($redis, $jobID);
// check integrity of /etc/network/interfaces
if (!hashCFG('check_mpd', $redis)) {
    $template->mpdconf = file_get_contents('/etc/mpd.conf');
    // set manual config template
    $template->content = "mpd_manual";
} else {
    $template->conf = $redis->hGetAll('mpdconf');
    $i2smodule = $redis->get('i2smodule');
    // debug
    // echo $i2smodule."\n";
    $acards = $redis->hGetAll('acards');
    // debug
    // print_r($acards);
    foreach ($acards as $card => $data) {
        $acard_data = json_decode($data);
        // debug
        // echo $card."\n";