From 1cd0d4fc79ee1dfcbfc91c4dc9b22afff085d611 Mon Sep 17 00:00:00 2001 From: absoluteSpacehead Date: Tue, 6 Feb 2024 21:40:56 +0000 Subject: [PATCH] Some requested changes --- Server/Source/Routes/Drafting.ts | 10 ++++++---- Server/Source/Schemas/Song.ts | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Server/Source/Routes/Drafting.ts b/Server/Source/Routes/Drafting.ts index d876f5e..f7ccb8e 100644 --- a/Server/Source/Routes/Drafting.ts +++ b/Server/Source/Routes/Drafting.ts @@ -220,9 +220,9 @@ App.post("/upload/audio", if (err) // FUCK return console.log(err); - if (metadata && metadata.streams && metadata.streams[0].codec_type == 'audio' && metadata.streams[0].channels && metadata.streams[0].channels > 2) // jfc ts + if (metadata.streams[0].codec_type == "audio" && metadata.streams[0].channels! > 2) { - Debug(`Creating preview stream as it's needed...`); + Debug("Creating preview stream as it's needed..."); // Oh shit!! we need a preview stream!! so let's make one. @@ -232,9 +232,11 @@ App.post("/upload/audio", // Then, figure out which channels from the original file to put into each channel on the output file. // We already ran ffprobe earlier so we can just reuse that lol + + // Output with 10 channels is "pan=stereo|c0=c0+c2+c4+c6+c8|c1=c1+c3+c5+c7+c9", ffmpeg uses this to decide how to downmix var FilterLeft = "pan=stereo|c0="; var FilterRight = "|c1="; - for (var i = 0; i < metadata.streams[0].channels; i++) + for (var i = 0; i < metadata.streams[0].channels!; i++) { if (i == 0 || i % 2 == 0) FilterLeft += `${i == 0 ? "" : "+"}c${i}` // out for 0 = "c0", out for 2 = "+c2" @@ -256,7 +258,7 @@ App.post("/upload/audio", .output(`${AudioPath}/PreviewChunks/PreviewManifest.mpd`) .on("start", cl => Debug(`Creating preview stream with ${magenta(cl)}`)) .on("end", async () => { - Debug(`Preview stream created`); + Debug("Preview stream created"); // Move the mpd out renameSync(`${AudioPath}/PreviewChunks/PreviewManifest.mpd`, `${AudioPath}/PreviewManifest.mpd`); writeFileSync(`${AudioPath}/PreviewManifest.mpd`, readFileSync(`${AudioPath}/PreviewManifest.mpd`).toString().replace(/[\w\d\r\n\t]*<\/ProgramInformation>/i, "{BASEURL}")); diff --git a/Server/Source/Schemas/Song.ts b/Server/Source/Schemas/Song.ts index 22d1f63..092bf25 100644 --- a/Server/Source/Schemas/Song.ts +++ b/Server/Source/Schemas/Song.ts @@ -21,8 +21,8 @@ export class Song extends BaseEntity { @PrimaryGeneratedColumn("uuid") ID: string; - @Column("uuid", { nullable: true, default: null }) - PID: string; + @Column("uuid", { nullable: true }) + PID?: string; @ManyToOne(() => User, U => U.CreatedTracks) Author: User; @@ -106,7 +106,7 @@ export class Song extends BaseEntity { Setup() { this.ID = v4(); - if (this.PID == undefined) // im lazy but this will work regardless + if (this.PID === undefined) // im lazy but this will work regardless this.PID = this.ID; // By default they should be the same to save space, if we *need* a preview stream later we can change this when processing audio this.Directory = `${SAVED_DATA_PATH}/Songs/${this.ID}`;