33 lines
832 B
PHP
33 lines
832 B
PHP
<?php
|
|
|
|
function killPlayingSong() {
|
|
system("killall -q " . MP3PLAYER);
|
|
}
|
|
|
|
function setSystemVolume($newvol = null) {
|
|
global $globaldbh;
|
|
|
|
if ( is_null($newvol) ) return false;
|
|
system("HOME=" . WEBUSERHOMEDIR . " && /usr/bin/amixer -q sset Master " . $newvol);
|
|
$query = "UPDATE " . SETTINGSTABLE . " SET value=:value WHERE parameter='CURVOLUME'";
|
|
$fields = array();
|
|
$fields[':value'] = $newvol;
|
|
$sth = $globaldbh->prepare($query);
|
|
$sth->execute($fields);
|
|
return true;
|
|
}
|
|
|
|
function getSystemVolume() {
|
|
global $globaldbh;
|
|
|
|
$query = "SELECT value FROM " . SETTINGSTABLE . " WHERE parameter='CURVOLUME'";
|
|
$sth = $globaldbh->prepare($query);
|
|
$sth->execute();
|
|
if ( $row = $sth->fetch(PDO::FETCH_ASSOC) ) {
|
|
$curvol = $row['value'];
|
|
} else {
|
|
$curvol = '0';
|
|
}
|
|
return $curvol;
|
|
}
|