Initial Commit
Some checks are pending
Build Docker Image / docker (push) Waiting to run
Test / test (push) Waiting to run

This commit is contained in:
Lillith Rose (Device: Lucia) 2025-06-08 14:33:19 -04:00
commit fdeba8fd41
17 changed files with 2290 additions and 0 deletions

54
src/index.ts Normal file
View file

@ -0,0 +1,54 @@
import ffmpeg from "fluent-ffmpeg";
import { Event, getCurrentEvent, loadEvents } from "setlist";
const commandBase = ffmpeg()
.input("rtsp://stream.furality.online/live/club")
.seekInput("0:01")
.audioCodec("copy")
.videoCodec("copy")
.outputOption("-y");
async function runCommand(event: Event) {
const eventEnd = new Date(event.end);
const now = new Date();
const secondsUntilEventEnd = Math.max(
0,
Math.floor((eventEnd.getTime() - now.getTime()) / 1000)
);
const command = commandBase.clone().duration(5);
const filename = event.name.replace(/ /g, "_");
console.log(`Saving ${secondsUntilEventEnd}s of 1440p to ${filename}.mkv`);
console.log(process.cwd());
command.save(`./output/${filename}.mkv`);
await new Promise<void>((res) => {
command.on("start", console.log);
command.on("error", (err) => {
throw err;
});
command.on("end", (cmd) => {
console.log(cmd);
res();
});
});
console.log("Command Done");
}
async function main() {
await loadEvents();
while (true) {
// find next
const event = getCurrentEvent();
if (!event?.name) {
console.error("No more sets!");
process.exit(0);
}
await runCommand(event);
// sleep 5s
await new Promise((res) => setTimeout(res, 5000));
}
}
main();