Beispiel #1
0
include "international.php";
include "player/mpd/connection.php";
$error = 0;
$dbterms = array('tags' => null, 'rating' => null);
$path = array_key_exists('path', $_REQUEST) ? rawurldecode($_REQUEST['path']) : "";
$prefix = array_key_exists('prefix', $_REQUEST) ? $_REQUEST['prefix'] . '_' : "dirholder";
@open_mpd_connection();
if ($is_connected) {
    if ($path == "") {
        print '<div class="configtitle textcentre expand" style="margin-left:6px"><b>' . get_int_text('button_file_browser') . '</b></div>';
    }
    doFileBrowse($path, $prefix);
} else {
    header("HTTP/1.1 500 Internal Server Error");
}
close_mpd();
function doFileBrowse($path, $prefix)
{
    global $connection, $prefs;
    debuglog("Browsing " . $path, "DIRBROWSER");
    $parts = true;
    $foundfile = false;
    $filedata = array();
    $dircount = 0;
    fputs($connection, 'lsinfo "' . format_for_mpd($path) . '"' . "\n");
    while (!feof($connection) && $parts) {
        $parts = getline($connection);
        if (is_array($parts)) {
            $s = trim($parts[1]);
            if (substr($s, 0, 1) != ".") {
                switch ($parts[0]) {
Beispiel #2
0
$outputdata = array();
@open_mpd_connection();
if ($is_connected) {
    $outputs = do_mpd_command("outputs", true);
    close_mpd($connection);
    foreach ($outputs as $i => $n) {
        if (is_array($n)) {
            foreach ($n as $a => $b) {
                debuglog($i . " - " . $b . ":" . $a, "AUDIO OUTPUT");
                $outputdata[$a][$i] = $b;
            }
        } else {
            debuglog($i . " - " . $n, "AUDIO OUTPUT");
            $outputdata[0][$i] = $n;
        }
    }
}
close_mpd($connection);
function printOutputCheckboxes()
{
    global $outputdata;
    for ($i = 0; $i < count($outputdata); $i++) {
        print '<div class="styledinputs">';
        print '<input type="checkbox" id="outputbutton_' . $i . '"';
        if ($outputdata[$i]['outputenabled'] == 1) {
            print ' checked';
        }
        print '><label for="outputbutton_' . $i . '" onclick="outputswitch(' . $i . ')">' . $outputdata[$i]['outputname'] . '</label>';
        print '</div>';
    }
}