Esempio n. 1
0
         $hexdark = "16a085";
     }
     // change to new theme color
     sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh " . $args . " " . $hexlight . " " . $hexdark);
     // reload tcmods.conf data
     $_tcmods_conf = getTcmodsConf();
     break;
     // TC (Tim Curtis) 2015-05-30: reload tcmods config data
 // TC (Tim Curtis) 2015-05-30: reload tcmods config data
 case 'reloadtcmodsconf':
     $_tcmods_conf = getTcmodsConf();
     break;
     // TC (Tim Curtis) 2014-12-23: reload clock radio settings from conf file
 // TC (Tim Curtis) 2014-12-23: reload clock radio settings from conf file
 case 'reloadclockradio':
     $_tcmods_conf = getTcmodsConf();
     $clock_radio_starttime = $_tcmods_conf['clock_radio_starttime'];
     $clock_radio_stoptime = $_tcmods_conf['clock_radio_stoptime'];
     break;
     // TC (Tim Curtis) 2015-02-25: process i2s driver select request
 // TC (Tim Curtis) 2015-02-25: process i2s driver select request
 case 'i2sdriver':
     // Remove any existing dtoverlay line(s)
     sysCmd('sed -i /dtoverlay/d /boot/config.txt');
     // Set i2s driver
     $kernelver = getKernelVer($_SESSION['kernelver']);
     if ($kernelver == '3.18.5+' || $kernelver == '3.18.11+' || $kernelver == '3.18.14+') {
         _setI2sDtoverlay($args);
         // Dtoverlay (/boot/config.txt)
     } else {
         _setI2sModules($args);
Esempio n. 2
0
function wrk_mpdconf($kernelver = null, $i2s = null)
{
    // extract mpd.conf from SQLite datastore
    $_tcmods_conf = getTcmodsConf();
    // $mpdcfg = ConfigDB::read('', 'mpdconf');
    $mpdcfg = array_column(ConfigDB::read('', 'mpdconf'), 'value_player', 'param');
    // set mpd.conf file header
    $output = "#########################################\n";
    $output .= "# This file is automatically generated by\n";
    $output .= "# the Player via MPD Configuration page. \n";
    $output .= "#########################################\n";
    $output .= "\n";
    foreach ($mpdcfg as $key => $val) {
        switch ($key) {
            // suppress
            case 'dsd_usb':
                break;
            case 'device':
                $device = $val;
                break;
            case 'mixer_type':
                // get volume mixer control name
                if ('hardware' == ($mixer_type = $mpdcfg['mixer_type'])) {
                    $hwmixer = getMixerName($kernelver, $i2s);
                    break;
                }
                // fallthrough - output mixer_type
            // fallthrough - output mixer_type
            default:
                // don't output disabled audio_output_format
                if ($key !== 'audio_output_format' || $val !== 'disabled') {
                    $output .= $key . " \"" . $val . "\"\n";
                }
        }
    }
    // format audio input / output interfaces
    $output .= <<<EOT
max_connections "20"

decoder {
plugin "ffmpeg"
enabled "yes"
}

input {
plugin "curl"
}

audio_output {
type "alsa"
name "Output"
device "hw:{$device},0"

EOT;
    if (isset($hwmixer)) {
        $output .= "mixer_control \"" . $hwmixer . "\"\n";
        $output .= "mixer_device \"hw:" . $device . "\"\n";
        $output .= "mixer_index \"0\"\n";
    }
    $output .= "dsd_usb \"" . $mpdcfg['dsd_usb'] . "\"\n";
    $output .= "}\n";
    // write mpd.conf file
    file_put_contents("/etc/mpd.conf", $output);
    // store volume mixer type in tcmods.conf
    if ($_tcmods_conf['volume_mixer_type'] != $mixer_type) {
        $_tcmods_conf['volume_mixer_type'] = $mixer_type;
        _updTcmodsConf($_tcmods_conf);
    }
}