Skip to content

Commit

Permalink
feat(extract): add extractDisableNightMode
Browse files Browse the repository at this point in the history
  • Loading branch information
jersou committed Oct 27, 2024
1 parent c26feec commit 4e1f2cf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 5 additions & 2 deletions extract_pack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ export class PackExtractor {
transitionCount = new Map<string, number>();
nightAction?: string;
questions = new Set<string>();
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(
Expand All @@ -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) {
Expand Down Expand Up @@ -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`,
Expand Down
3 changes: 3 additions & 0 deletions studio_pack_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4e1f2cf

Please sign in to comment.