tts-narrator
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -37,2 +37,6 @@ import { TtsServiceType } from './script-processor'; | ||
script: NarrationScript; | ||
/** | ||
* Path of the generated audio file. Only for in-memory processing, not supposed to be stored in file. | ||
*/ | ||
audioFilePath?: string; | ||
constructor(paragraph: NarrationScriptFile.Paragraph, index: number, section: NarrationSection, chapter: NarrationChapter, script: NarrationScript); | ||
@@ -39,0 +43,0 @@ get settings(): VoiceSettings; |
@@ -33,3 +33,3 @@ import { flags } from '@oclif/command'; | ||
protected audioGenerationOptions: AudioGenerationOptions | undefined; | ||
protected script: NarrationScript; | ||
protected _script: NarrationScript; | ||
protected chapterRange: MultiRange | undefined; | ||
@@ -46,3 +46,4 @@ protected sectionRange: MultiRange | undefined; | ||
runWithoutCatch(reconstructedcommandLine?: string): Promise<void>; | ||
get script(): NarrationScript; | ||
} | ||
//# sourceMappingURL=script-processor.d.ts.map |
@@ -54,3 +54,3 @@ "use strict"; | ||
async loadScript() { | ||
this.script = await (0, narration_script_1.loadScript)(this.scriptFilePath); | ||
this._script = await (0, narration_script_1.loadScript)(this.scriptFilePath); | ||
this.cliConsole.debug(`Loaded script from ${this.scriptFilePath}`); | ||
@@ -81,3 +81,3 @@ } | ||
if (!this.ttsService) { | ||
const ttsServiceType = (_a = this.flags.service) !== null && _a !== void 0 ? _a : this.script.settings.service; | ||
const ttsServiceType = (_a = this.flags.service) !== null && _a !== void 0 ? _a : this._script.settings.service; | ||
switch (ttsServiceType) { | ||
@@ -97,3 +97,3 @@ case TtsServiceType.Azure: | ||
async determineAudioFilePath(ssmlHash, _paragraph) { | ||
const audioFileFolder = this.script.scriptFilePath.split('.').slice(0, -1).join('.') + '.tts'; | ||
const audioFileFolder = this._script.scriptFilePath.split('.').slice(0, -1).join('.') + '.tts'; | ||
if (!fs.existsSync(audioFileFolder)) { | ||
@@ -124,3 +124,3 @@ fs.mkdirSync(audioFileFolder); | ||
// walk through the script | ||
for (const chapter of this.script.chapters) { | ||
for (const chapter of this._script.chapters) { | ||
const chapterIndex = chapter.index; | ||
@@ -177,2 +177,3 @@ if (!this.chapterRange || this.chapterRange.has(chapterIndex)) { | ||
const audioFilePath = await this.processGeneratedAudioFile(generatedAudioFilePath); | ||
paragraph.audioFilePath = audioFilePath; | ||
// play .mp3 file if needed | ||
@@ -191,3 +192,6 @@ if (this.flags.play) { | ||
} | ||
get script() { | ||
return this.script; | ||
} | ||
} | ||
exports.ScriptProcessor = ScriptProcessor; |
{ | ||
"name": "tts-narrator", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Generate narration with Text-To-Speech technology", | ||
@@ -5,0 +5,0 @@ "main": "dist/types.js", |
@@ -697,2 +697,3 @@ # tts-narrator | ||
- [audioFilePath](#audiofilepath) | ||
- [chapter](#chapter) | ||
@@ -728,2 +729,10 @@ - [index](#index) | ||
##### audioFilePath | ||
• `Optional` **audioFilePath**: `string` | ||
Path of the generated audio file. Only for in-memory processing, not supposed to be stored in file. | ||
___ | ||
##### chapter | ||
@@ -1028,2 +1037,3 @@ | ||
- [\_script](#_script) | ||
- [audioGenerationOptions](#audiogenerationoptions) | ||
@@ -1033,3 +1043,2 @@ - [chapterRange](#chapterrange) | ||
- [flags](#flags) | ||
- [script](#script) | ||
- [scriptFilePath](#scriptfilepath) | ||
@@ -1039,2 +1048,6 @@ - [sectionRange](#sectionrange) | ||
##### Accessors | ||
- [script](#script) | ||
##### Methods | ||
@@ -1066,2 +1079,8 @@ | ||
##### \_script | ||
• `Protected` **\_script**: [`NarrationScript`](#classesnarrationscriptmd) | ||
___ | ||
##### audioGenerationOptions | ||
@@ -1091,8 +1110,2 @@ | ||
##### script | ||
• `Protected` **script**: [`NarrationScript`](#classesnarrationscriptmd) | ||
___ | ||
##### scriptFilePath | ||
@@ -1114,2 +1127,12 @@ | ||
#### Accessors | ||
##### script | ||
• `get` **script**(): [`NarrationScript`](#classesnarrationscriptmd) | ||
###### Returns | ||
[`NarrationScript`](#classesnarrationscriptmd) | ||
#### Methods | ||
@@ -1116,0 +1139,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
82677
700
1603