diff --git a/webhook/exclude-djs.txt b/webhook/exclude-djs.txt new file mode 100644 index 0000000..3d6ad6d --- /dev/null +++ b/webhook/exclude-djs.txt @@ -0,0 +1 @@ +alrs diff --git a/webhook/index.php b/webhook/index.php index ea3e667..dc0f0ac 100644 --- a/webhook/index.php +++ b/webhook/index.php @@ -6,24 +6,26 @@ if ($json["live"]["is_live"]) { // start recording $streamer = $json["live"]["streamer_name"]; - $current_pid = intval(file_get_contents("ffmpeg.pid")); - // posix_kill with 0 signal tells you if the process is running - if ($current_pid != "" && posix_kill($current_pid, 0)) die(); + if (!in_array($streamer, file("exclude-djs.txt")) { + $current_pid = intval(file_get_contents("ffmpeg.pid")); + // posix_kill with 0 signal tells you if the process is running + if ($current_pid != "" && posix_kill($current_pid, 0)) die(); - $timestamp = date("Y-m-d\TH_i_s"); - if (!is_dir(__DIR__."/../$streamer")) { - mkdir(__DIR__."/../$streamer"); - copy(__DIR__."/../djindex.php", __DIR__."/../$streamer/index.php"); + $timestamp = date("Y-m-d\TH_i_s"); + if (!is_dir(__DIR__."/../$streamer")) { + mkdir(__DIR__."/../$streamer"); + copy(__DIR__."/../djindex.php", __DIR__."/../$streamer/index.php"); + } + + $standard_stream = "https://radio.tildeverse.org/radio/8000/radio.ogg"; + $testing_stream = "https://radio.tildeverse.org/radio/8010/radio.mp3"; + $metadata = "-metadata title=\"tilderadio archive - $timestamp\" -metadata artist=\"$streamer\""; + $cmd = "/usr/bin/ffmpeg -i $standard_stream $metadata ../$streamer/tilderadio-$streamer-$timestamp.mp3 >out.log 2>&1 & echo $!"; + $pid = exec($cmd); + + echo $pid; + file_put_contents("ffmpeg.pid", $pid); } - - $standard_stream = "https://radio.tildeverse.org/radio/8000/radio.ogg"; - $testing_stream = "https://radio.tildeverse.org/radio/8010/radio.mp3"; - $metadata = "-metadata title=\"tilderadio archive - $timestamp\" -metadata artist=\"$streamer\""; - $cmd = "/usr/bin/ffmpeg -i $standard_stream $metadata ../$streamer/tilderadio-$streamer-$timestamp.mp3 >out.log 2>&1 & echo $!"; - $pid = exec($cmd); - - echo $pid; - file_put_contents("ffmpeg.pid", $pid); } else { // stop recording $pid = file_get_contents("ffmpeg.pid");