mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 17:58:02 -05:00
fix a header sending error, sent twice
This commit is contained in:
@@ -14,6 +14,7 @@ var fs = require('fs');
|
|||||||
|
|
||||||
const { PutObjectCommand, S3Client } = require("@aws-sdk/client-s3");
|
const { PutObjectCommand, S3Client } = require("@aws-sdk/client-s3");
|
||||||
const { fromIni } = require("@aws-sdk/credential-providers");
|
const { fromIni } = require("@aws-sdk/credential-providers");
|
||||||
|
const e = require('express');
|
||||||
|
|
||||||
var s3_endpoint = process.env['S3_ENDPOINT'] != null ? process.env['S3_ENDPOINT'] : 'https://s3.us-west-1.wasabisys.com';
|
var s3_endpoint = process.env['S3_ENDPOINT'] != null ? process.env['S3_ENDPOINT'] : 'https://s3.us-west-1.wasabisys.com';
|
||||||
var s3_region = process.env['S3_REGION'] != null ? process.env['S3_REGION'] : 'us-west-1';
|
var s3_region = process.env['S3_REGION'] != null ? process.env['S3_REGION'] : 'us-west-1';
|
||||||
@@ -177,43 +178,47 @@ const createPodcast = async (tmpEventFolder, podcastFile, event) => {
|
|||||||
inputs.forEach((value, i) => {
|
inputs.forEach((value, i) => {
|
||||||
concat = concat + "file '" + value + "'\n";
|
concat = concat + "file '" + value + "'\n";
|
||||||
});
|
});
|
||||||
const concatFile = tmpEventFolder + "/FILES.txt"
|
try {
|
||||||
fs.writeFileSync(concatFile, concat, "utf8");
|
const concatFile = tmpEventFolder + "/FILES.txt"
|
||||||
// https://video.stackexchange.com/questions/21315/concatenating-split-media-files-using-concat-protocol
|
fs.writeFileSync(concatFile, concat, "utf8");
|
||||||
//ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
|
// https://video.stackexchange.com/questions/21315/concatenating-split-media-files-using-concat-protocol
|
||||||
command.push("-hide_banner");
|
//ffmpeg -f concat -safe 0 -i mylist.txt -c copy output
|
||||||
command.push("-loglevel");
|
command.push("-hide_banner");
|
||||||
command.push("error");
|
command.push("-loglevel");
|
||||||
command.push("-f");
|
command.push("error");
|
||||||
command.push("concat");
|
command.push("-f");
|
||||||
command.push("-safe");
|
command.push("concat");
|
||||||
command.push("0");
|
command.push("-safe");
|
||||||
command.push("-i");
|
command.push("0");
|
||||||
command.push(concatFile);
|
command.push("-i");
|
||||||
command.push("-acodec");
|
command.push(concatFile);
|
||||||
command.push("aac");
|
command.push("-acodec");
|
||||||
command.push(tmpFile);
|
command.push("aac");
|
||||||
await ffmpeg(command);
|
command.push(tmpFile);
|
||||||
|
await ffmpeg(command);
|
||||||
|
|
||||||
|
|
||||||
const chapters = createChapters(event);
|
const chapters = createChapters(event);
|
||||||
const chaptersFile = tmpEventFolder + "/CHAPTERS.txt"
|
const chaptersFile = tmpEventFolder + "/CHAPTERS.txt"
|
||||||
fs.writeFileSync(chaptersFile, chapters, "utf8");
|
fs.writeFileSync(chaptersFile, chapters, "utf8");
|
||||||
command = [];
|
command = [];
|
||||||
command.push("-hide_banner");
|
command.push("-hide_banner");
|
||||||
command.push("-loglevel");
|
command.push("-loglevel");
|
||||||
command.push("error");
|
command.push("error");
|
||||||
command.push("-i");
|
command.push("-i");
|
||||||
command.push(tmpFile)
|
command.push(tmpFile)
|
||||||
command.push("-i");
|
command.push("-i");
|
||||||
command.push(chaptersFile)
|
command.push(chaptersFile)
|
||||||
command.push("-map_metadata")
|
command.push("-map_metadata")
|
||||||
command.push("1")
|
command.push("1")
|
||||||
command.push("-codec");
|
command.push("-codec");
|
||||||
command.push("copy");
|
command.push("copy");
|
||||||
command.push(podcastFile)
|
command.push(podcastFile)
|
||||||
//console.log("Running command: " + command);
|
//console.log("Running command: " + command);
|
||||||
await ffmpeg(command);
|
await ffmpeg(command);
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Error creating podcast " + e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanupEvent = (folder, filename) => {
|
const cleanupEvent = (folder, filename) => {
|
||||||
@@ -382,11 +387,12 @@ exports.addNewEvent = async function (req, res, next) {
|
|||||||
const savedEvent = await event.save();
|
const savedEvent = await event.save();
|
||||||
//console.log("Event ID " + savedEvent._id);
|
//console.log("Event ID " + savedEvent._id);
|
||||||
const url = "/events/" + event._id;
|
const url = "/events/" + event._id;
|
||||||
res.contentType('json');
|
|
||||||
res.send(JSON.stringify({ url: url }));
|
|
||||||
|
|
||||||
await packageEvent(savedEvent._id);
|
await packageEvent(savedEvent._id);
|
||||||
|
|
||||||
|
res.contentType('json');
|
||||||
|
res.send(JSON.stringify({ url: url }));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
console.error("Error creating event" + err);
|
console.error("Error creating event" + err);
|
||||||
|
|||||||
Reference in New Issue
Block a user