aboutsummaryrefslogtreecommitdiff
path: root/oworadio/credits/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'oworadio/credits/index.php')
-rw-r--r--oworadio/credits/index.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/oworadio/credits/index.php b/oworadio/credits/index.php
new file mode 100644
index 0000000..b4ce7b5
--- /dev/null
+++ b/oworadio/credits/index.php
@@ -0,0 +1,17 @@
+<?php
+
+exec("mpc -p 6601 current", $song);
+$db = json_decode(file_get_contents("/mnt/oworadio-backend/downloader/metadata/stats.json"), true);
+$id = explode(".", $song[0])[0];
+
+foreach ($db as $iid => $item) {
+ if ($item["id"] === $id) {
+ $cid = $iid;
+ }
+}
+
+if (isset($db[$cid]["title"]) && trim($db[$cid]["title"]) !== "") {
+ echo(implode(", ", $db[$cid]["artists"]) . " ยท " . $db[$cid]["title"]);
+} else {
+ echo("Unknown Song");
+} \ No newline at end of file