本文整理汇总了PHP中sendMpdCommand函数的典型用法代码示例。如果您正苦于以下问题:PHP sendMpdCommand函数的具体用法?PHP sendMpdCommand怎么用?PHP sendMpdCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sendMpdCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: settingsTest
public static function settingsTest($app)
{
$socket = openMpdSocket('/run/mpd.sock');
sendMpdCommand($socket, 'status');
$song = readMpdResponse($socket);
// var_dump(self::parsePlaylist($song));
echo json_encode(playerController::parsePlaylist($song));
}
示例2: fclose
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!=''";
$mpdcfg = sdbquery($query_cfg, $dbh);
$dbh = null;
foreach ($mpdcfg as $cfg) {
if ($cfg['param'] == 'audio_output_format' && $cfg['value_player'] == 'disabled') {
$output .= '';
} else {
if ($cfg['param'] == 'device') {
$device = $cfg['value_player'];
示例3: file_put_contents
<script src="js/jquery.placeholder.js"></script>
<script src="js/parsley.min.js"></script>
<script src="js/i18n/_messages.en.js" type="text/javascript"></script>
<script src="js/application.js"></script>
<script src="js/volumio.settings.js"></script>
<script src="js/jquery.pnotify.min.js"></script>
<script src="js/bootstrap-fileupload.js"></script>
<?php
}
//WebRadio Add Dialog
if (isset($_POST['radio-name']) && isset($_POST['radio-url'])) {
$url = $_POST['radio-url'];
$name = $_POST['radio-name'];
$ret = file_put_contents('/var/lib/mpd/music/WEBRADIO/' . $name . '.pls', $url);
session_start();
sendMpdCommand($mpd, 'update WEBRADIO');
// set UI notify
$_SESSION['notify']['msg'] = 'New WebRadio Added';
// unlock session file
playerSession('unlock');
}
?>
<script type="text/javascript">
setLibOptions(
<? echo isset($_SESSION['displaylib']) && $_SESSION['displaylib'] == 1 ? 1 : 0;?>/*is enabled?*/,
<? echo isset($_SESSION['displaylibastab']) && $_SESSION['displaylibastab'] == 1 ? 1 : 0;?>/*display as tab o
<? echo $sezione == 'index' ? 1 : 0; ?>/*should load it?*/
);
loadLibraryIfNeeded();
</script>
示例4: playerSession
playerSession('open', $db, '', '');
playerSession('unlock', $db, '', '');
// set template
$tpl = "indextpl.html";
?>
<!-- content --!>
<?php
eval("echoTemplate(\"" . getTemplate("templates/{$tpl}") . "\");");
?>
<!-- content -->
<?php
//generic functions in home
if (isset($_POST['syscmd'])) {
if ($_SESSION['w_lock'] != 1 && $_SESSION['w_queue'] == '') {
session_start();
sendMpdCommand($mpd, 'clear');
// set UI notify
$_SESSION['notify']['title'] = 'Clear Queue';
$_SESSION['notify']['msg'] = 'Play Queue Cleared';
// unlock session file
playerSession('unlock');
} else {
echo "background worker busy";
}
// unlock session file
playerSession('unlock');
}
?>
<?php
include '_footer.php';
示例5: sendSpopCommand
$sSpopCommand = $sRawCommand;
}
}
}
}
}
}
}
}
if (isset($sSpopCommand)) {
// If command is to be passed to spop
if (strcmp($sSpopCommand, "") != 0) {
sendSpopCommand($spop, $sSpopCommand);
}
} else {
// Else pass command to MPD
sendMpdCommand($mpd, $sRawCommand);
}
}
} else {
echo json_encode(['service' => 'MPD COMMAND INTERFACE', 'disclaimer' => 'INTERNAL USE ONLY!', 'hosted_on' => gethostname() . ":" . $_SERVER['SERVER_PORT']]);
}
if ($mpd) {
closeMpdSocket($mpd);
}
if ($spop) {
closeSpopSocket($spop);
}
?>
示例6: sendMpdCommand
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RuneAudio; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.txt>.
*
* file: app/sources_ctl.php
* version: 1.3
* coder: Simone De Gregori
*
*/
// inspect POST
if (isset($_POST)) {
if ($_POST['updatempd'] == 1) {
sendMpdCommand($mpd, 'update');
}
if ($_POST['mountall'] == 1) {
$jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'sourcecfg', 'action' => 'mountall'));
}
if (isset($_POST['usb-umount'])) {
$jobID = wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'sourcecfg', 'action' => 'umountusb', 'args' => $_POST['usb-umount']));
}
if (!empty($_POST['mount'])) {
$_POST['mount']['remotedir'] = str_replace('\\', '/', $_POST['mount']['remotedir']);
if ($_POST['mount']['rsize'] == '') {
$_POST['mount']['rsize'] = 16384;
}
if ($_POST['mount']['wsize'] == '') {
$_POST['mount']['wsize'] = 17408;
}
示例7: strpos
}
break;
default:
$spopCommandPos = strpos($commandName, "spop-");
if ($spopCommandPos != -1) {
$spopCommand = trim(substr($commandName, 5, strlen($commandName) - 5));
if (isset($_POST['path']) && $_POST['path'] != '') {
$spopCommand .= " " . $_POST['path'];
}
if (isset($_POST['p2']) && $_POST['p2'] != '') {
$spopCommand .= " " . $_POST['p2'];
}
// stop any mpd playback
$playBackCommands = array("play", "stop", "next", "prev", "goto", "add", "uplay", "uadd");
if (in_array($spopCommand, $playBackCommands)) {
sendMpdCommand($mpd, "stop");
}
echo json_encode(sendSpopCommand($spop, $spopCommand));
}
break;
}
}
} else {
echo json_encode(['service' => 'MPD DB INTERFACE', 'disclaimer' => 'INTERNAL USE ONLY!', 'hosted_on' => gethostname() . ":" . $_SERVER['SERVER_PORT']]);
}
if ($mpd) {
closeMpdSocket($mpd);
}
if ($spop) {
closeSpopSocket($spop);
}
示例8: execMpdCommand
function execMpdCommand($sock, $command)
{
sendMpdCommand($sock, $command);
return readMpdResponse($sock);
}
示例9: error_reporting
*
* You should have received a copy of the GNU General Public License
* along with RaspyFi; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*
* UI-design/JS code by: Andrea Coiutti (aka ACX)
* PHP/JS code by: Simone De Gregori (aka Orion)
*
* file: command/index.php
* version: 1.0
*
*/
// common include
include '../inc/connection.php';
error_reporting(ERRORLEVEL);
if (isset($_GET['cmd']) && $_GET['cmd'] != '') {
if (!$mpd) {
echo 'Error Connecting to MPD daemon ';
} else {
sendMpdCommand($mpd, $_GET['cmd']);
closeMpdSocket($mpd);
}
} else {
echo 'MPD COMMAND INTERFACE<br>';
echo 'INTERNAL USE ONLY<br>';
echo 'hosted on raspyfi.local:82';
}
?>
示例10: currentSong
public static function currentSong($app)
{
$app->response->headers->set('Content-Type', 'application/json');
$socket = openMpdSocket('/run/mpd.sock');
sendMpdCommand($socket, 'currentsong');
$song = readMpdResponse($socket);
$obj = array("song" => self::parsePlaylist($song));
echo json_encode($obj);
}
示例11: sendMpdCommand
break;
case 'update':
if (isset($_POST['path']) && $_POST['path'] != '') {
sendMpdCommand($mpd, "update \"" . html_entity_decode($_POST['path']) . "\"");
echo json_encode(readMpdResponse($mpd));
}
break;
case 'trackremove':
if (isset($_GET['songid']) && $_GET['songid'] != '') {
echo json_encode(remTrackQueue($mpd, $_GET['songid']));
}
break;
case 'savepl':
if (isset($_GET['plname']) && $_GET['plname'] != '') {
sendMpdCommand($mpd, "rm \"" . html_entity_decode($_GET['plname']) . "\"");
sendMpdCommand($mpd, "save \"" . html_entity_decode($_GET['plname']) . "\"");
echo json_encode(readMpdResponse($mpd));
}
break;
case 'search':
if (isset($_POST['query']) && $_POST['query'] != '' && isset($_GET['querytype']) && $_GET['querytype'] != '') {
echo json_encode(searchDB($mpd, $_GET['querytype'], $_POST['query']));
}
break;
}
closeMpdSocket($mpd);
}
} else {
echo 'MPD DB INTERFACE<br>';
echo 'INTERNAL USE ONLY<br>';
echo 'hosted on raspyfi.local:81';
示例12: _parseStatusResponse
if ($activePlayer === 'MPD') {
if (isset($_POST['path'])) {
$status = _parseStatusResponse(MpdStatus($mpd));
$pos = $status['playlistlength'];
addAlbumToQueue($mpd, $_POST['path'], 1, $pos);
// send MPD response to UI
ui_mpd_response($mpd, array('title' => 'Added to queue', 'text' => $_POST['path']));
}
}
break;
case 'albumaddreplaceplay':
if ($activePlayer === 'MPD') {
if (isset($_POST['path'])) {
sendMpdCommand($mpd, 'clear');
addAlbumToQueue($mpd, $_POST['path']);
sendMpdCommand($mpd, 'play');
// send MPD response to UI
ui_mpd_response($mpd, array('title' => 'Queue cleared<br> Added to queue', 'text' => $_POST['path']));
}
}
break;
}
} else {
echo 'MPD DB INTERFACE<br>';
echo 'INTERNAL USE ONLY<br>';
echo 'hosted on runeaudio.local:81';
}
// close palyer backend connection
if ($activePlayer === 'MPD') {
// close MPD connection
closeMpdSocket($mpd);
示例13: playlistRemove
public static function playlistRemove($app, $num)
{
$socket = openMpdSocket('/run/mpd.sock');
sendMpdCommand($socket, "deleteid " . $num);
$infos = readMpdResponse($socket);
var_dump($infos);
}
示例14: json_encode
$sSpopCommand = $sRawCommand;
}
}
}
}
}
}
}
}
if (isset($sSpopCommand)) {
// If command is to be passed to spop
if (strcmp($sSpopCommand, "") != 0) {
echo json_encode(sendSpopCommand($spop, $sSpopCommand));
}
} else {
// Else pass command to MPD
echo json_encode(sendMpdCommand($mpd, $sRawCommand));
}
}
} else {
echo json_encode(['service' => 'MPD COMMAND INTERFACE', 'disclaimer' => 'INTERNAL USE ONLY!', 'hosted_on' => gethostname() . ":" . $_SERVER['SERVER_PORT']]);
}
if ($mpd) {
closeMpdSocket($mpd);
}
if ($spop) {
closeSpopSocket($spop);
}
?>
示例15: addQueue
addQueue($mpd, $_POST['path']);
sendMpdCommand($mpd, 'play ' . $pos);
echo json_encode(readMpdResponse($mpd));
}
break;
case 'addreplaceplay':
if (isset($_POST['path']) && $_POST['path'] != '') {
sendMpdCommand($mpd, 'clear');
addQueue($mpd, $_POST['path']);
sendMpdCommand($mpd, 'play');
echo json_encode(readMpdResponse($mpd));
}
break;
case 'update':
if (isset($_POST['path']) && $_POST['path'] != '') {
sendMpdCommand($mpd, "update \"" . html_entity_decode($_POST['path']) . "\"");
echo json_encode(readMpdResponse($mpd));
}
break;
case 'trackremove':
if (isset($_GET['songid']) && $_GET['songid'] != '') {
echo json_encode(remTrackQueue($mpd, $_GET['songid']));
}
break;
case 'search':
if (isset($_POST['query']) && $_POST['query'] != '' && isset($_GET['querytype']) && $_GET['querytype'] != '') {
echo json_encode(searchDB($mpd, $_GET['querytype'], $_POST['query']));
}
break;
}
closeMpdSocket($mpd);