json as array instead of object

This commit is contained in:
Ben Harris 2020-06-28 06:55:55 +00:00
parent 428bdbe0b9
commit b954d0e411

View File

@ -1,10 +1,10 @@
<?php <?php
$json = json_decode(file_get_contents('php://input')); $json = json_decode(file_get_contents('php://input'), true);
if ($json->live->is_live) { if ($json["live"]["is_live"]) {
// start recording // start recording
$streamer = $json->live->streamer_name; $streamer = $json["live"]["streamer_name"];
$current_pid = intval(file_get_contents("ffmpeg.pid")); $current_pid = intval(file_get_contents("ffmpeg.pid"));
// posix_kill with 0 signal tells you if the process is running // posix_kill with 0 signal tells you if the process is running
@ -13,7 +13,7 @@ if ($json->live->is_live) {
$timestamp = date("Y-m-d\TH_i_s"); $timestamp = date("Y-m-d\TH_i_s");
if (!is_dir(__DIR__."/../$streamer")) { if (!is_dir(__DIR__."/../$streamer")) {
mkdir(__DIR__."/../$streamer"); mkdir(__DIR__."/../$streamer");
copy(__DIR__."/../djindex.html", __DIR__."/../$streamer/index.html"); copy(__DIR__."/../djindex.php", __DIR__."/../$streamer/index.php");
} }
$standard_stream = "https://radio.tildeverse.org/radio/8000/radio.ogg"; $standard_stream = "https://radio.tildeverse.org/radio/8000/radio.ogg";