back
' . "\n";
}
function print_lists() {
$handle = popen("LC_ALL=C ls ~musix/.moc/Listen", "r");
$i = 1;
while (!feof($handle)) {
$s = fgets($handle);
if (substr($s,0,7) !== "_lokal_") {
continue;
}
$lists[$i] = substr($s,7);
$i++;
}
foreach ($lists as $i => $list) {
print '' . $list . "
\n";
}
}
$commands['stop'] = 'mocp -M ~musix/.moc -s';
$commands['play'] = 'mocp -M ~musix/.moc -p';
$commands['pause'] = 'mocp -M ~musix/.moc -G';
$commands['next'] = 'mocp -M ~musix/.moc -f';
$commands['prev'] = 'mocp -M ~musix/.moc -r';
$commands['shuffle on'] = 'mocp -M ~musix/.moc -o shuffle';
$commands['shuffle off'] = 'mocp -M ~musix/.moc -u shuffle';
$commands['lauter'] = 'lautstaerke +5';
$commands['viel lauter'] = 'lautstaerke +25';
$commands['leiser'] = 'lautstaerke -5';
$commands['viel leiser'] = 'lautstaerke -25';
function details($max_line_len = 0) {
foreach (explode("\n",shell_exec("mocp -M ~musix/.moc -i 2>/dev/null")) as $line) {
if (substr($line,0,7)=="State: ")
$state = substr($line,7);
if (substr($line,0,6)=="File: ")
$file = basename(substr($line,6));
if (substr($line,0,10)=="TimeLeft: ")
$time = substr($line,10);
}
$max_file_len = $max_line_len - 4 - strlen($state) - strlen($time);
if ($max_line_len && (strlen($file) > $max_file_len))
$file = "..." . substr($file,3-$max_file_len);
return $state . " " . $file . " (" . $time . ")";
}
function list_info($max_line_len = 0) {
$list = substr(shell_exec("head -n1 ~musix/.moc/_playlist.m3u"),0,-1);
$cnt = substr(shell_exec("wc -l < ~musix/.moc/Listen/" . $list),0,-1);
$max_list_len = $max_line_len - 3 - strlen($cnt);
if ($max_line_len && (strlen($list) > $max_list_len))
$list = "..." . substr($list,3-$max_list_len);
return $list . " (" . $cnt . ")";
}
function print_known_commands() {
global $commands;
foreach ($commands as $key => $command) {
print ' ' . $key . '
' . "\n";
}
}