-
Notifications
You must be signed in to change notification settings - Fork 2
/
status.php
56 lines (54 loc) · 1.65 KB
/
status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<div id="status">
<?php
$credit=credit();
echo "<center>
<span class=\"credit\">Credit: ".$credit."</span><br />
<span class=\"playing_h\"><a name=\"status\"></a>";
switch($mpd_status["state"]) {
case "play":
echo "Playing:";
break;
case "pause":
do_mpd_command($connection,"play",null,true);
echo "Playing:";
break;
case "stop":
do_mpd_command($connection,"play",null,true);
echo "Playing:";
break;
}
//echo " <small>[";
//make_link("index.php", "status", "refresh");
//echo "]</small></h2>";
echo "</span><br /><span class=\"playing\">";
if((array_key_exists("command", $_REQUEST) && $_REQUEST["command"])) {
if($command_successful !== true && $configuration["error_msg"])
echo "Error on command ".$_REQUEST["command"]." with arguments: ".$_REQUEST["arg"]."<br />\n";
}
switch($mpd_status["state"]) {
case "play":
case "pause":
$songinfo = do_mpd_command($connection, "playlistid ".$mpd_status["songid"], null, true);
if($configuration["filenames_only"] == true) {
echo $songinfo["file"];
} else {
echo format_song_title($configuration["song_display_format"], $songinfo, $mpd_status["song"]);
}
$elapsed_time = floatval(trim(strtok($mpd_status["time"], ":")));
$total_time = floatval(trim(strtok("\0")));
$remaining_time = $total_time - $elapsed_time;
echo "<br />\n(";
if($configuration["time_elapsed"] == true) {
make_link("", "status", format_time($elapsed_time), array("time_elapsed" => "false"));
echo ")/";
} else {
echo "-";
make_link("", "status", format_time($remaining_time), array("time_elapsed" => "true"));
echo ") ";
}
echo "[".format_time($total_time)."]";
// echo $mpd_status["bitrate"]." kbps";
break;
}
?>
</span></center></div>