Add webhook code (from ben/radiobot)

This commit is contained in:
Robert Miles 2018-11-30 22:42:25 -05:00
parent 3a1ddac115
commit cc9ce6041b
1 changed files with 17 additions and 0 deletions

17
webhook.php Normal file
View File

@ -0,0 +1,17 @@
<?php
$json = json_decode(file_get_contents('php://input'));
$resp = array();
if ($json->live->is_live) {
$resp["dj"] = $json->live->streamer_name;
} else {
$resp["dj"] = NULL;
}
$resp["song"] = $json->now_playing->song->text;
$resp["listeners"] = $json->listeners->current;
file_put_contents("now_playing.json", json_encode($resp));