aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/anki-note-builder.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-09-10 11:57:38 -0400
committerGitHub <noreply@github.com>2020-09-10 11:57:38 -0400
commit35abd517b933036b95bb58b463a48edd1c985bb1 (patch)
tree34a31589727c6e04659cc7195b5c27b61df5036e /ext/bg/js/anki-note-builder.js
parent17ebe6a754d53fad97ab607f17e2bba8d8565361 (diff)
AudioUriBuilder simplification (#799)
* Rename variables to disambiguate * Update handler argument convention * Update getUri argument convention * Change _getAudioUri argument convention * Change getDefinitionAudio argument convention * Add api.getDefinitionAudio definition
Diffstat (limited to 'ext/bg/js/anki-note-builder.js')
-rw-r--r--ext/bg/js/anki-note-builder.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/bg/js/anki-note-builder.js b/ext/bg/js/anki-note-builder.js
index 72e3b337..a558db92 100644
--- a/ext/bg/js/anki-note-builder.js
+++ b/ext/bg/js/anki-note-builder.js
@@ -124,15 +124,16 @@ class AnkiNoteBuilder {
try {
const {sources, customSourceUrl} = details;
const expressions = definition.expressions;
- const audioSourceDefinition = Array.isArray(expressions) ? expressions[0] : definition;
+ const {expression, reading} = Array.isArray(expressions) ? expressions[0] : definition;
- let fileName = this._createInjectedAudioFileName(audioSourceDefinition);
+ let fileName = this._createInjectedAudioFileName(expression, reading);
if (fileName === null) { return; }
fileName = this._replaceInvalidFileNameCharacters(fileName);
const {audio: data} = await this._getDefinitionAudio(
- audioSourceDefinition,
sources,
+ expression,
+ reading,
{
textToSpeechVoice: null,
customSourceUrl,
@@ -199,8 +200,7 @@ class AnkiNoteBuilder {
}
}
- _createInjectedAudioFileName(definition) {
- const {reading, expression} = definition;
+ _createInjectedAudioFileName(expression, reading) {
if (!reading && !expression) { return null; }
let fileName = 'yomichan';