コード例 #1
0
ファイル: mpd-config.php プロジェクト: dermidgen/moode
    }
}
// Handle POST
if (isset($_POST['conf']) && !empty($_POST['conf'])) {
    foreach ($_POST['conf'] as $key => $value) {
        ConfigDB::update('cfg_mpd', $key, $value);
    }
    // Tell worker to write new MPD config
    if ($workerSuccess = workerPushTask('mpdcfg')) {
        uiSetNotification('MPD config modified', 'Restarting MPD server...');
    }
}
// Handle manual config
if (isset($_POST['mpdconf']) && !empty($_POST['mpdconf'])) {
    // tell worker to write new MPD config
    if ($workerSuccess = workerPushTask('mpdcfgman', $_POST['mpdconf'])) {
        uiSetNotification('MPD config modified', 'Restarting MPD server...');
    }
}
// could not start worker job
if (false === $workerSuccess) {
    uiSetNotification('Job failed', 'Background worker is busy');
}
Session::close();
// Wait for worker
waitWorker();
$mpdconf = ConfigDB::read('', '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' => '', 'dsd_usb' => '', 'device' => '', 'volume_normalization' => '');
// Parse output for template $_mpdconf
foreach ($mpdconf as $key => $value) {
コード例 #2
0
ファイル: tcmods.php プロジェクト: dermidgen/moode
            if ($workerSuccess = workerPushTask("poweroff")) {
                uiSetNotification('Shutdown', 'System shutdown initiated...');
            }
            $tpl = "poweroff";
            break;
        case 'reboot':
            if ($workerSuccess = workerPushTask("reboot")) {
                uiSetNotification('Reboot', 'System reboot initiated...');
            }
            $tpl = "reboot";
            break;
        case 'reloadclockradio':
            $workerSuccess = workerPushTask("reloadclockradio");
            break;
        case 'reloadtcmodsconf':
            $workerSuccess = workerPushTask("reloadtcmodsconf");
            break;
        default:
            uiSetNotification('Error', 'Invalid command: ' . $_POST['syscmd']);
    }
    // TODO check if uiNotification rather than echo()
    if (false === $workerSuccess) {
        uiSetNotification('Job failed', 'Background worker is busy');
        echo "Background worker is busy";
    }
    // Display template if not clock radio reload or tcmods conf reload
    if (isset($tpl)) {
        render($tpl);
    }
    exit;
}
コード例 #3
0
ファイル: settings.php プロジェクト: dermidgen/moode
}
/*
 * One-time tasks
 */
if (isset($_POST['update_clear_syslogs']) && $_POST['clearsyslogs'] == 1) {
    if ($workerSuccess = workerPushTask('clearsyslogs')) {
        uiSetNotification('Log maintenance', "System logs have been cleared.", 4);
    }
}
if (isset($_POST['update_clear_playhistory']) && $_POST['clearplayhistory'] == 1) {
    if ($workerSuccess = workerPushTask('clearplayhistory')) {
        uiSetNotification('Log maintenance', "Playback history log hase been cleared.", 4);
    }
}
if (isset($_POST['update_expand_sdcard']) && $_POST['expandsdcard'] == 1) {
    if ($workerSuccess = workerPushTask('expandsdcard')) {
        uiSetNotification('Expand SD Card Storage', "Storage expansion request has been queued. REBOOT has been initiated.", 6);
    }
}
if (false === $workerSuccess) {
    uiSetNotification('Job failed', 'Background worker is busy');
}
/*
 * Render template
 */
// configure html select elements
$kernelver = getKernelVer($_SESSION['kernelver']);
if ($kernelver == '3.18.5+' || $kernelver == '3.18.11+' || $kernelver == '3.18.14+') {
    $dacs = array('I2S Off', 'Audiophonics I-Sabre DAC', 'Durio Sound PRO', 'G2 Labs BerryNOS', 'G2 Labs BerryNOS Red', 'HiFiBerry Amp(Amp+)', 'HiFiBerry DAC', 'HiFiBerry DAC+', 'HiFiBerry Digi(Digi+)', 'Hifimediy ES9023', 'IQaudIO Pi-AMP+', 'IQaudIO Pi-DAC', 'IQaudIO Pi-DAC+', 'IQaudIO Pi-DigiAMP+', 'RaspyPlay4', 'RPi DAC', 'Generic');
    foreach ($dacs as $dac) {
        $dacName = $dac == 'I2S Off' ? 'None' : $dac;
コード例 #4
0
ファイル: sources.php プロジェクト: dermidgen/moode
    }
    // TC (Tim Curtis) 2015-02-25: remove cifs noatime option, not supported on kernel 3.12.26+ / MPD 0.19.1, causes mount to fail with errors
    if ($_POST['mount']['options'] == '') {
        $_POST['mount']['options'] = $_POST['mount']['type'] == 'cifs' ? "cache=strict,ro,dir_mode=0777,file_mode=0777" : "nfsvers=3,ro,noatime";
    }
    // activate worker
    if (isset($_POST['delete']) && $_POST['delete'] == 1) {
        // delete an existing entry
        $_POST['mount']['action'] = 'delete';
        if (workerPushTask('sourcecfg', $_POST)) {
            uiSetNotification('Mount point deleted', 'MPD database update initiated...');
        } else {
            uiSetNotification('Job failed', 'Background worker is busy');
        }
    } else {
        if (workerPushTask('sourcecfg', $_POST)) {
            uiSetNotification('Mount point modified', 'MPD database update initiated...');
        } else {
            uiSetNotification('Job failed', 'Background worker is busy');
        }
    }
}
Session::close();
// wait for worker
waitWorker();
// update MPD db after worker finishes
if (false !== ($mpd = openMpdSocket(MPD_HOST, 6600))) {
    execMpdCommand($mpd, 'update');
    closeMpdSocket($mpd);
}
$source = ConfigDB::read('cfg_source');
コード例 #5
0
ファイル: net-config.php プロジェクト: dermidgen/moode
            }
        }
        $eth0 = "\nauto eth0\niface eth0 inet dhcp\n";
    }
    // end wlan0
    // handle manual config
    if (isset($_POST['netconf']) && !empty($_POST['netconf'])) {
        // tell worker to write new MPD config
        if (workerPushTask("netcfgman", $_POST['netconf'])) {
            uiSetNotification('Network config', 'Network config modified');
        } else {
            uiSetNotification('Job failed', 'Background worker is busy');
        }
    }
    // create job for background worker
    if (workerPushTask('netcfg', $wlan0 . $eth0)) {
        uiSetNotification('Network config', isset($_GET['reset']) && $_GET['reset'] == 1 ? 'Network config reset' : 'Network config modified');
    } else {
        uiSetNotification('Job failed', 'Background worker is busy');
    }
    // unlock session file
    Session::close();
}
// wait for worker
waitWorker();
$net = ConfigDB::read('cfg_lan');
$wifisec = ConfigDB::read('cfg_wifisec');
// eth0
$_eth0 = isset($_SESSION['netconf']['eth0']) && !empty($_SESSION['netconf']['eth0']) ? $_SESSION['netconf']['eth0']['ip'] : "Not used";
$_int0dhcp = "<option value=\"true\" " . (isset($net[0]['dhcp']) && $net[0]['dhcp'] == "true" ? "selected" : "") . " >enabled (Auto)</option>\n";
$_int0dhcp .= "<option value=\"false\" " . (isset($net[0]['dhcp']) && $net[0]['dhcp'] == "false" ? "selected" : "") . " >disabled (Static)</option>\n";