summaryrefslogtreecommitdiffstats
path: root/radio/radio.php
diff options
context:
space:
mode:
Diffstat (limited to 'radio/radio.php')
-rw-r--r--radio/radio.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/radio/radio.php b/radio/radio.php
new file mode 100644
index 0000000..4c8bf3f
--- /dev/null
+++ b/radio/radio.php
@@ -0,0 +1,38 @@
+<?php
+$sock = stream_socket_client("unix:///tmp/ls", $errno, $errstr);
+if (!empty($_REQUEST["s"])) {
+ fwrite($sock, "travnik.skip\r\n");
+ header("location: ?p=1");
+ exit("preusmeritev na ?p=1");
+}
+fwrite($sock, "uptime\r\n");
+usleep(100000);
+$uptime = trim(str_replace("END", "", fread($sock, 256)));
+fwrite($sock, "travnik.remaining\r\n");
+usleep(100000);
+$remaining = trim(str_replace("END", "", fread($sock, 256)));
+fwrite($sock, "travnik.metadata\r\n");
+usleep(100000);
+$metadata = str_replace("\r", "", trim(str_replace("END", "", fread($sock, 65536))));
+fwrite($sock, "quit\r\n");
+?>
+radijski pretok neprestano teče že <?= htmlspecialchars($uptime) ?>
+<br>
+do konca komada je še <?= gmdate("H:i:s", intval($remaining)) ?>.
+<br>
+<form method=post>
+<input type=submit name=s value="preskoči na naslednji komad" />
+</form>
+<?php
+if (!empty($_REQUEST["p"])) {
+?>
+<b>poročilo: zahteva za preskok komada je bila uspešno poslana. počakaj nekaj sekund, da se zgodi crossfade. preveri, da si na koncu pretoka!</b>
+<?php
+}
+?>
+<br>
+metapodatki o komadu in o prej predvajanih komadih:
+<br>
+<pre>
+<?= htmlspecialchars(implode("\n", array_reverse(explode("\n", $metadata)))) ?>
+</pre>