From 54d4c65854289de9d454198d7575d3db824cf0f1 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 12 Oct 2019 23:04:32 -0400 Subject: Rename audioGetFromSources's createAudioObject argument to download --- ext/bg/js/audio.js | 2 +- ext/mixed/js/audio.js | 4 ++-- ext/mixed/js/display.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/bg/js/audio.js b/ext/bg/js/audio.js index 9e0ae67c..1a626d42 100644 --- a/ext/bg/js/audio.js +++ b/ext/bg/js/audio.js @@ -163,7 +163,7 @@ async function audioInject(definition, fields, sources, optionsContext) { audioSourceDefinition = definition.expressions[0]; } - const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, false); + const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, true); if (url !== null) { const filename = audioBuildFilename(audioSourceDefinition); if (filename !== null) { diff --git a/ext/mixed/js/audio.js b/ext/mixed/js/audio.js index 5e3b9164..50bd321f 100644 --- a/ext/mixed/js/audio.js +++ b/ext/mixed/js/audio.js @@ -32,7 +32,7 @@ function audioGetFromUrl(url) { }); } -async function audioGetFromSources(expression, sources, optionsContext, createAudioObject, cache=null) { +async function audioGetFromSources(expression, sources, optionsContext, download, cache=null) { const key = `${expression.expression}:${expression.reading}`; if (cache !== null && cache.hasOwnProperty(expression)) { return cache[key]; @@ -46,7 +46,7 @@ async function audioGetFromSources(expression, sources, optionsContext, createAu } try { - const audio = createAudioObject ? await audioGetFromUrl(url) : null; + const audio = download ? null : await audioGetFromUrl(url); const result = {audio, url, source}; if (cache !== null) { cache[key] = result; diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 51a3dc22..cf38d09d 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -500,7 +500,7 @@ class Display { } const sources = this.options.audio.sources; - let {audio, source} = await audioGetFromSources(expression, sources, this.getOptionsContext(), true, this.audioCache); + let {audio, source} = await audioGetFromSources(expression, sources, this.getOptionsContext(), false, this.audioCache); let info; if (audio === null) { if (this.audioFallback === null) { -- cgit v1.2.3