From 044073eca7d759dfc72f01edd536955bb99e4a7c Mon Sep 17 00:00:00 2001 From: RblSb Date: Sun, 12 Apr 2026 14:14:15 +0300 Subject: [PATCH] --oggonly for html5 exporter --- out/Exporters/Html5Exporter.js | 2 +- out/khamake.js | 5 +++++ src/Exporters/Html5Exporter.ts | 2 +- src/Options.ts | 1 + src/khamake.ts | 5 +++++ 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/out/Exporters/Html5Exporter.js b/out/Exporters/Html5Exporter.js index d5b383a5..f46c7d4a 100644 --- a/out/Exporters/Html5Exporter.js +++ b/out/Exporters/Html5Exporter.js @@ -187,7 +187,7 @@ class Html5Exporter extends KhaExporter_1.KhaExporter { let mp4_size = 0; let mp3 = false; let mp3_size = 0; - if (!this.isDebugHtml5()) { + if (!this.isDebugHtml5() && !this.options.oggonly) { mp4 = await (0, Converter_1.convert)(from, path.join(this.options.to, this.sysdir(), to + '.mp4'), this.options.aac); if (mp4) { mp4_size = (await fs.stat(path.join(this.options.to, this.sysdir(), to + '.mp4'))).size; diff --git a/out/khamake.js b/out/khamake.js index e393c6f8..c8c9c1dc 100644 --- a/out/khamake.js +++ b/out/khamake.js @@ -146,6 +146,11 @@ let options = [ value: true, default: '' }, + { + full: 'oggonly', + description: 'Generate only ogg files for the html5 target, without `mp3/mp4` fallback', + value: false, + }, { full: 'krafix', description: 'Location of krafix shader compiler', diff --git a/src/Exporters/Html5Exporter.ts b/src/Exporters/Html5Exporter.ts index c85bd544..d163e129 100644 --- a/src/Exporters/Html5Exporter.ts +++ b/src/Exporters/Html5Exporter.ts @@ -223,7 +223,7 @@ export class Html5Exporter extends KhaExporter { let mp4_size = 0; let mp3 = false; let mp3_size = 0; - if (!this.isDebugHtml5()) { + if (!this.isDebugHtml5() && !this.options.oggonly) { mp4 = await convert(from, path.join(this.options.to, this.sysdir(), to + '.mp4'), this.options.aac); if (mp4) { mp4_size = (await fs.stat(path.join(this.options.to, this.sysdir(), to + '.mp4'))).size; diff --git a/src/Options.ts b/src/Options.ts index 5d4c9522..dd16d15c 100644 --- a/src/Options.ts +++ b/src/Options.ts @@ -41,6 +41,7 @@ export class Options { ogg: string; aac: string; mp3: string; + oggonly: boolean; h264: string; webm: string; wmv: string; diff --git a/src/khamake.ts b/src/khamake.ts index cfc2f0a3..da88e8d8 100644 --- a/src/khamake.ts +++ b/src/khamake.ts @@ -148,6 +148,11 @@ let options: Array = [ value: true, default: '' }, + { + full: 'oggonly', + description: 'Generate only ogg files for the html5 target, without `mp3/mp4` fallback', + value: false, + }, { full: 'krafix', description: 'Location of krafix shader compiler',