1
0
Fork 0

add files

This commit is contained in:
Christopher Latza 2020-06-07 18:12:25 +02:00
parent 50c8ef8907
commit 84b1697ec6
7 changed files with 84 additions and 2 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM debian:latest
WORKDIR /root/
RUN apt-get update && apt-get install -y ffmpeg curl php-cli php-xml
COPY start.sh /root/start.sh
COPY config.php /root/config.php
COPY start.php /root/start.php
RUN chmod +x start.sh
CMD ['bash', 'start.sh']

View File

@ -1,2 +0,0 @@
# Discord-RTML-Notice

5
config.php Normal file
View File

@ -0,0 +1,5 @@
<?php
$StreamURL = "%%StreamURL%%";
$DiscordWebhook = "%%DiscordWebhook%%";
?>

BIN
ffmpeg.exe Normal file

Binary file not shown.

22
message.json Normal file
View File

@ -0,0 +1,22 @@
{
"embeds": [
{
"title": "RTMP Stream Online!",
"description": "Ein neuer RTMP Stream ist jetzt online! Wenn du ihn dir anschauen willst kannst du dies mit dem VLC Media Player tun.\nÖffne dazu den VLC Media Player, klicke oben links auf Medien und wähle Netzwerkstream. Trage dort dann folgene Adresse ein:\n\n%%adresse%%\n\n",
"color": 2139936,
"author": {
"name": "RTMP Noticer",
"url": "https://clatza.dev/Christopher/Discord-RTML-Notice.git",
"icon_url": "https://files.clatza.dev/Icons/git.png"
},
"image": {
"url": "https://files.clatza.dev/output.jpg"
},
"thumbnail": {
"url": "https://files.clatza.dev/Icons/vlc.png"
}
}
],
"username": "RTMP Noticer",
"avatar_url": "https://files.clatza.dev/Icons/vlc.png"
}

41
start.php Normal file
View File

@ -0,0 +1,41 @@
<?php
include "config.php";
$lastOnlineTime = time();
while(TRUE)
{
if(($lastOnlineTime + 500) < time())
{
$fileName = "output-".time().".jpg";
system("ffmpeg -i ".$StreamURL." -vframes 1 -q:v 2 -vf scale=535:346 ".$fileName);
if(is_file($fileName))
{
$lastOnlineTime = time();
copy($fileName, "tmp/rtmp/".$fileName);
unlink($fileName);
$jsonMessage = json_decode(file_get_contents("message.json"));
$jsonMessage->embeds->description = str_replace("%%adresse%%", $StreamURL, $jsonMessage->embeds->description);
$jsonMessage->embeds->image = "https://files.clatza.dev/tmp/rtmp/".$fileName;
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-Type: application/json',
'content' => json_encode($jsonMessage)
]
];
$result = file_get_contents($DiscordWebhook, false, stream_context_create($options));
}
}else{
sleep(5);
}
}
?>

4
start.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
sed -i "s|%%StreamURL%%|${StreamURL}|" config.php
sed -i "s|%%DiscordWebhook%%|${DiscordWebhook}|" config.php