From 738f929411d063ec2e4b95140018e550731a96ef Mon Sep 17 00:00:00 2001 From: Mindless999 Date: Mon, 29 Dec 2025 11:52:53 +0100 Subject: [PATCH 1/3] Allow build to run on MacOS --- make.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/make.js b/make.js index ba2c802..d2728bc 100644 --- a/make.js +++ b/make.js @@ -2,6 +2,12 @@ import { execSync } from "child_process"; import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs"; import { platform } from "os"; +//Check if using MacOS +const isMac = process.platform === "darwin"; + +// Used to have items writable during build on MacOS +import fs from "fs"; + const run = (cmd) => execSync(cmd, { stdio: "inherit" }); const binPath = platform() === "win32" ? ".\\build\\float.exe" : "./build/float"; @@ -22,7 +28,19 @@ copyFileSync(process.execPath, binPath); writeFileSync("./build/version", JSON.parse(readFileSync("./package.json")).version); // Create the blob -run("node --experimental-sea-config ./sea-config.json"); +if (isMac) { + execSync("node --experimental-sea-config sea-config.json", { + stdio: "inherit", + }); + // Set permissions for float which otherwise breaks the build or run + fs.chmodSync("./build/float", 0o755); + + console.log("macOS SEA build complete (no postject)"); + process.exit(0); +} +else{ + run("node --experimental-sea-config ./sea-config.json"); +} // Inject the blob run(`npx postject ${binPath} NODE_SEA_BLOB ./dist/float.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA`); From 56fe50b74058497f621d57ede1ec6e1652df5762 Mon Sep 17 00:00:00 2001 From: Mindless999 Date: Mon, 29 Dec 2025 19:27:21 +0100 Subject: [PATCH 2/3] Fix metadata so plex understands it for release date --- src/lib/Video.ts | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/src/lib/Video.ts b/src/lib/Video.ts index 3820d7d..16eb429 100644 --- a/src/lib/Video.ts +++ b/src/lib/Video.ts @@ -242,6 +242,8 @@ export class Video extends Attachment { season = match[1]; episode = match[2]; } + // Determine the unique episode number based on releaseDate + const releaseDate = this.releaseDate; const nfo = builder .create() .ele("episodedetails") @@ -258,7 +260,10 @@ export class Video extends Attachment { .txt(htmlToText(this.description)) .up() .ele("aired") // format: yyyy-mm-dd required for Kodi/Plex - .txt(this.releaseDate.getFullYear().toString() + "-" + nPad(this.releaseDate.getMonth() + 1) + "-" + nPad(this.releaseDate.getDate())) + .txt(`${releaseDate.getUTCFullYear()}-${nPad(releaseDate.getUTCMonth() + 1)}-${nPad(releaseDate.getUTCDate())}`) + .up() + .ele("originallyavailable") // plesk NFO uses Original vailable for actual air dates, if it uses NFO + .txt(`${releaseDate.getUTCFullYear()}-${nPad(releaseDate.getUTCMonth() + 1)}-${nPad(releaseDate.getUTCDate())}`) .up() .ele("season") .txt(season) @@ -367,14 +372,26 @@ export class Video extends Attachment { await unlink(this.muxedPath).catch(nll); const description = htmlToText(this.description); + const releaseDate = this.releaseDate; + const year = releaseDate.getUTCFullYear(); + const yearStart = new Date(Date.UTC(year, 0, 1)); + const episode = Math.floor((releaseDate.getTime() - yearStart.getTime()) / 1000); + const airedDate = new Date(releaseDate); + const creationTime = airedDate.toISOString().replace(/\.\d{3}Z$/, "Z"); + const airedDateStr = `${airedDate.getUTCFullYear()}-${nPad(airedDate.getUTCMonth() + 1)}-${nPad(airedDate.getUTCDate())}`; // format: yyyy-mm-dd required for Kodi/Plex const metadata = { - title: this.videoTitle, - AUTHOR: this.channelTitle, - YEAR: this.releaseDate.getFullYear().toString(), - date: `${this.releaseDate.getFullYear().toString()}${nPad(this.releaseDate.getMonth() + 1)}${nPad(this.releaseDate.getDate())}`, - description: description, - synopsis: description, - }; + title: this.videoTitle, + AUTHOR: this.channelTitle, + YEAR: year.toString(), + date: airedDateStr, + description: description, + synopsis: description, + show: this.channelTitle, + season_number: year.toString(), + episode_id: episode.toString(), + creation_time: creationTime, + }; + const metadataArgs = Object.entries(metadata).flatMap(([key, value]) => ["-metadata", `${key}=${value}`]); const metadataFilePath = `${this.folderPath}/${Math.random()}.ffmeta`; const metadataContent = Object.entries(metadata) .map(([key, value]) => `${key}=${value.replaceAll(/\n/g, "\\\n")}`) @@ -394,6 +411,7 @@ export class Video extends Attachment { "0", "-map_metadata", "1", + ...metadataArgs, "-c", "copy", this.muxedPath, @@ -410,7 +428,7 @@ export class Video extends Attachment { // Remove the partial file when done await unlink(this.partialPath); // Set the files update time to when the video was released - await utimes(this.muxedPath, new Date(), this.releaseDate); + await utimes(this.muxedPath, new Date(), releaseDate); (await this.attachmentInfo()).muxedBytes = await Video.pathBytes(this.muxedPath); } finally { From 9168337f59073803b8bf9f4eefa27885d9459783 Mon Sep 17 00:00:00 2001 From: Mindless999 Date: Mon, 29 Dec 2025 22:10:48 +0100 Subject: [PATCH 3/3] Revert "Allow build to run on MacOS" This reverts commit 738f929411d063ec2e4b95140018e550731a96ef. --- make.js | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/make.js b/make.js index d2728bc..ba2c802 100644 --- a/make.js +++ b/make.js @@ -2,12 +2,6 @@ import { execSync } from "child_process"; import { copyFileSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs"; import { platform } from "os"; -//Check if using MacOS -const isMac = process.platform === "darwin"; - -// Used to have items writable during build on MacOS -import fs from "fs"; - const run = (cmd) => execSync(cmd, { stdio: "inherit" }); const binPath = platform() === "win32" ? ".\\build\\float.exe" : "./build/float"; @@ -28,19 +22,7 @@ copyFileSync(process.execPath, binPath); writeFileSync("./build/version", JSON.parse(readFileSync("./package.json")).version); // Create the blob -if (isMac) { - execSync("node --experimental-sea-config sea-config.json", { - stdio: "inherit", - }); - // Set permissions for float which otherwise breaks the build or run - fs.chmodSync("./build/float", 0o755); - - console.log("macOS SEA build complete (no postject)"); - process.exit(0); -} -else{ - run("node --experimental-sea-config ./sea-config.json"); -} +run("node --experimental-sea-config ./sea-config.json"); // Inject the blob run(`npx postject ${binPath} NODE_SEA_BLOB ./dist/float.blob --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 --macho-segment-name NODE_SEA`);