app/templates/header.php 0000644 0000000 0000000 00000014340 00000007121 014251 0 ustar root root
RuneAudio - RuneUI
uri(1)) OR ($this->uri(1) == 'playback')): ?>
app/templates/fade.php 0000644 0000041 0000041 00000003073 00000006202 013722 0 ustar http http
mpc_fade 0000755 0000000 0000000 00000001633 00000003072 011220 0 ustar root root MPC=`which mpc`
MPC=/usr/bin/mpc
BACKUP_VOLUME=`$MPC volume | sed -e 's/[^0-9]*\([0-9]*\).*/\1/'`
BC="`which bc` -l"
BC=/usr/bin/bc
# MPDRUNFILE="/var/run/mpd.pid"
# backup_wakeup ()
# {
# mpc volume $BACKUP_VOLUME > /dev/null
# mpc clear; mpc load startup;mpc play
# }
if [ $# -ne 3 ] ; then
echo "usage: mpc-fade " ;
exit 1 ;
fi
# # check if mpd is running, and with some files to play
# if [ ! -e $MPDRUNFILE ] ; then
# backup_wakeup ;
## fi
# if [ `mpc playlist | wc -l` -eq 0 ] ; then
# backup_wakeup ;
# fi
VOLUME=$1
$MPC play > /dev/null
if [ $1 -lt $2 ] ; then
while [ $VOLUME -le $2 ] ; do
$MPC volume $VOLUME > /dev/null ;
VOLUME=$(($VOLUME + 1)) ;
sleep `echo "$3/($2-$1)" | $BC` ;
done ;
else
while [ $VOLUME -ge $2 ] ; do
$MPC volume $VOLUME > /dev/null ;
VOLUME=$(($VOLUME - 1)) ;
sleep `echo "$3/($1-$2)" | $BC` ;
done ;
fi
exit 0
# eof
app/fade_ctl.php 0000644 0000000 0000000 00000002247 00000000672 012573 0 ustar root root .
*
* file: app/credits_ctl.php
* version: 1.3
* coder: Simone De Gregori
*
*/
$template->buildversion = $redis->get('buildversion');
index.php 0000764 0000041 0000041 00000011344 12464372041 011407 0 ustar http http .
*
* file: index.php
* version: 1.3
* coder: Simone De Gregori
*
*/
// load configuration
include($_SERVER['HOME'].'/app/config/config.php');
// main include
include($_SERVER['HOME'].'/app/libs/vendor/autoload.php');
// open session
session_start();
// plates: create new engine
$engine = new \League\Plates\Engine('/srv/http/app/templates');
// plates: load asset extension
$engine->loadExtension(new \League\Plates\Extension\Asset('/srv/http/assets', true));
// plates: load URI extension
$engine->loadExtension(new \League\Plates\Extension\URI($_SERVER['REQUEST_URI']));
// plates: create a new template
$template = new \League\Plates\Template($engine);
// set devmode
$template->dev = $devmode;
// activePlayer
$activePlayer = $redis->get('activePlayer');
// TODO: rework needed
$template->activePlayer = $activePlayer;
// allowed controllers
$controllers = array(
'credits',
'fade',
'coverart',
'dev',
'debug',
'help',
'index',
'login',
'mpd',
'network',
'playback',
'settings',
'sources',
'tun'
);
// check page
if (in_array($template->uri(1), $controllers) OR empty($template->uri(1))) {
// decode REQUEST_URL and assing section
if (!empty($template->uri(1)) && ($template->uri(1) !== 'playback')) {
// decode ACTION
if (!empty($template->uri(2))) {
$template->action = $template->uri(2);
// assign SUB-TEMPLATE
if ($template->action === 'add') {
$subtpl = 'edit';
} else {
$subtpl = $template->action;
}
// decode ARG
if(!empty($template->uri(3))) {
$template->arg = $template->uri(3);
}
// assign TEMPLATE
$template->content = $template->uri(1).'_'.$subtpl;
} else {
// assign TEMPLATE
$template->content = $template->uri(1);
}
$template->section = $template->uri(1);
// debug
//runelog("index: section",$template->section);
// debug
//runelog("index: selected controller(1)",APP.$template->uri(1));
// load selected APP Controller
include(APP.$template->uri(1).'_ctl.php');
// register current controller in SESSION
if ($template->uri(1) !== 'coverart' && $template->uri(1) !== 'coverart2') {
$_SESSION['controller'] = $template->uri(1);
}
} else {
// debug
//runelog("index: selected controller(2)",'playback_ctl.php');
// load playback APP Controller
include(APP.'playback_ctl.php');
$template->section = 'index';
$template->content = 'playback';
// register current controller in SESSION
$_SESSION['controller'] = 'playback';
}
} else {
$template->section = 'error';
$template->content = 'error';
// register current controller in SESSION
$_SESSION['controller'] = 'error';
}
// set devmode
$template->dev = $devmode;
// plates: render layout (if you want to output direct, set $tplfile = 0 into controller)
if ($tplfile !== 0) {
echo $template->render('default_lo');
}
// close palyer backend connection
if ($activePlayer === 'MPD') {
// close MPD connection
closeMpdSocket($mpd);
} elseif ($activePlayer === 'Spotify') {
// close SPOP connection
closeSpopSocket($spop);
}
// notifications
$notifications = $redis->hGetAll('notifications');
if (!empty($notifications) && $tplfile !== 0) {
foreach ($notifications as $raw_notification) {
wrk_control($redis, 'newjob', $data = array('wrkcmd' => 'ui_notify', 'args' => $notifications, 'delay_us' => 450000));
}
}
// close Redis connection
// $redis->close();
// close session
session_write_close();