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); } }
sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh chg-name browsertitle " . $args); break; case 'airplay_name': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh chg-name airplay " . $args); break; case 'upnp_name': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh chg-name upnp " . $args); break; case 'dlna_name': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh chg-name dlna " . $args); break; // TC (Tim Curtis) 2015-04-29: handle PCM volume change // TC (Tim Curtis) 2015-04-29: handle PCM volume change case 'pcm_volume': // TC (Tim Curtis) 2015-06-26: set simple mixer name based on kernel version and i2s vs USB $mixername = getMixerName(getKernelVer($_SESSION['kernelver']), $_SESSION['i2s']); sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh set-pcmvol " . $mixername . " " . $args); break; // TC (Tim Curtis) 2015-05-30: add clear system and playback history logs // TC (Tim Curtis) 2015-05-30: add clear system and playback history logs case 'clearsyslogs': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/utility.sh clear-logs"); break; case 'clearplayhistory': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/utility.sh clear-playhistory"); break; // TC (Tim Curtis) 2015-07-31: expand sd card storage // TC (Tim Curtis) 2015-07-31: expand sd card storage case 'expandsdcard': sysCmd("/var/www/tcmods/" . MOODE_RELEASE . "/cmds/resizefs.sh start"); break;
$_system_select['host_name'] = $_SESSION['host_name']; $_system_select['browser_title'] = $_SESSION['browser_title']; $_system_select['airplay_name'] = $_SESSION['airplay_name']; $_system_select['upnp_name'] = $_SESSION['upnp_name']; $_system_select['dlna_name'] = $_SESSION['dlna_name']; // TC (Tim Curtis) 2015-04-29: add PCM (alsamixer) volume // TC (Tim Curtis) 2015-06-26: updated logic if ($_SESSION['pcm_volume'] == 'none') { $_pcm_volume = ''; $_pcm_volume_readonly = 'readonly'; $_pcm_volume_hide = 'hide'; $_pcm_volume_msg = "<span class=\"help-block help-block-margin\">PCM volume mixer not detected for attached audio device</span>"; } else { // TC (Tim Curtis) 2015-06-26: get current volume setting, requires www-data user in visudo // TC (Tim Curtis) 2015-06-26: set simple mixer name based on kernel version and i2s vs USB $mixername = getMixerName($kernelver, $_SESSION['i2s']); $cmd = "sudo /var/www/tcmods/" . MOODE_RELEASE . "/cmds/tcmods.sh get-pcmvol " . $mixername; $rtn = sysCmd($cmd); $_pcm_volume = str_replace("%", "", $rtn[0]); if (isset($_POST['pcm_volume']) && $_pcm_volume != $_POST['pcm_volume']) { // player_wrk has not processed the change yet $_pcm_volume = $_POST['pcm_volume']; } $_pcm_volume_readonly = ''; $_pcm_volume_hide = ''; $_pcm_volume_msg = ''; } // TC (Tim Curtis) 2015-02-25: add kernel select list // TC (Tim Curtis) 2015-06-26: add 3.18.14 and 3.18.11 kernels to select list if ($_SESSION['procarch'] == "armv7l") { // Pi-2