forked from tilderadio/archive
init
This commit is contained in:
commit
b0830f23ed
|
@ -0,0 +1,4 @@
|
|||
*/
|
||||
!webhook/
|
||||
webhook/*.log
|
||||
webhook/ffmpeg.pid
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
$dj = basename(__DIR__);
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><?=$dj?>'s tilderadio archives</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://tilde.team/css/hacker.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1><?=$dj?>'s archive</h1>
|
||||
<p><a href="..">< back</a></p>
|
||||
<hr>
|
||||
<?php
|
||||
foreach (glob("/var/www/html/$dj/*.mp3") as $dir) {
|
||||
$name = basename($dir);
|
||||
?>
|
||||
<div class="list-group">
|
||||
<a href="./<?=$name?>" class="list-group-item">
|
||||
<p class="list-group-item-text"><?=$name?></p>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
|
@ -0,0 +1,31 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>tilderadio archives</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="https://tilde.team/css/hacker.css">
|
||||
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>tilderadio archive</h1>
|
||||
<p><a href="https://tilderadio.org">back to tilderadio.org</a> - <a href="https://radio.tildeverse.org/radio/8000/radio.ogg">listen now</a></p>
|
||||
<hr>
|
||||
<?php
|
||||
foreach (glob("/var/www/html/*") as $dir) {
|
||||
$name = basename($dir);
|
||||
if ($name == "webhook" || !is_dir($dir)) continue;
|
||||
?>
|
||||
<div class="list-group">
|
||||
<a href="<?=$name?>/" class="list-group-item">
|
||||
<p class="list-group-item-text"><?=$name?></p>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
$json = json_decode(file_get_contents('php://input'));
|
||||
|
||||
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();
|
||||
|
||||
$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";
|
||||
$cmd = "/usr/bin/ffmpeg -i $standard_stream ../$streamer/tilderadio-$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");
|
||||
if ($pid != "" && posix_kill(intval($pid), 0)) {
|
||||
posix_kill(intval($pid), 2);
|
||||
file_put_contents("ffmpeg.pid", "");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue