From 4e1f2cf20518615efa0b046c0ff3f8d5d8dda8d6 Mon Sep 17 00:00:00 2001 From: Jerem Date: Sun, 27 Oct 2024 15:41:16 +0100 Subject: [PATCH] feat(extract): add extractDisableNightMode --- README.md | 1 + extract_pack.ts | 7 +++++-- studio_pack_generator.ts | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c61b842..f793fc5 100644 --- a/README.md +++ b/README.md @@ -258,6 +258,7 @@ Options: --coqui-tts-language-idx coqui TTS language_idx [default: "fr"] --coqui-tts-speaker-idx coqui TTS speaker_idx [default: "Abrahan Mack"] -x, --extract extract a zip pack (reverse mode) [default: false] + --extract-disable-night-mode disable night mode in extract mode [default: false] -u, --gui open GUI (on localhost:5555) [default: false] --port port of GUI server [default: 5555] --skip-read-tts-cache disable the TTS cache usage [default: false] diff --git a/extract_pack.ts b/extract_pack.ts index b08ed43..d9c133f 100755 --- a/extract_pack.ts +++ b/extract_pack.ts @@ -30,9 +30,11 @@ export class PackExtractor { transitionCount = new Map(); nightAction?: string; questions = new Set(); + opt: StudioPackGenerator; constructor(opt: StudioPackGenerator) { this.packPath = opt.storyPath; this.outputPath = opt.outputFolder ?? opt.storyPath + "-extract"; + this.opt = opt; } async init() { this.zipReader = new ZipReader( @@ -47,7 +49,7 @@ export class PackExtractor { this.story.stageNodes.forEach((s) => this.stageMap.set(s.uuid, s)); this.story.actionNodes.forEach((a) => this.actionMap.set(a.id, a)); - if (this.story.nightModeAvailable) { + if (this.story.nightModeAvailable && !this.opt.extractDisableNightMode) { this.story.stageNodes.forEach((s) => { const dest = s.okTransition?.actionNode; if (dest) { @@ -145,7 +147,8 @@ export class PackExtractor { "description": this.story?.description ?? "", "format": this.story?.format ?? "", "version": this.story?.version ?? 0, - "nightMode": !!this.story?.nightModeAvailable, + "nightMode": !!this.story?.nightModeAvailable && + !this.opt.extractDisableNightMode, }; await Deno.writeTextFile( `${this.outputPath}/metadata.json`, diff --git a/studio_pack_generator.ts b/studio_pack_generator.ts index c0b1be1..255542b 100755 --- a/studio_pack_generator.ts +++ b/studio_pack_generator.ts @@ -157,6 +157,9 @@ export class StudioPackGenerator { @alias("x") extract = false; + @help("disable night mode in extract mode") + extractDisableNightMode = false; + @help("open GUI (on localhost:5555)") @alias("u") gui = false;