From 7c9808cda197442af43fa969a588d7f5e7b66780 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 14 May 2023 17:02:47 +0200 Subject: status quo --- index.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..d7eec31 --- /dev/null +++ b/index.php @@ -0,0 +1,52 @@ +\n"; + 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); + } + print $state . " " . $file . " (" . $time . ")
\n"; + print trim(shell_exec("cryptstatus")); + break; + case "info": + $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 (strlen($list) > $max_list_len) + $list = "..." . substr($list,3-$max_list_len); + print $list . " (" . $cnt . ")"; + break; + case "details": + 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 (strlen($file) > $max_file_len) + $file = "..." . substr($file,3-$max_file_len); + print $state . " " . $file . " (" . $time . ")"; + break; + case "crypt": + print shell_exec("cryptstatus"); + break; + default: + die(); +} -- cgit v1.2.3-70-g09d2