Rename audioGetFromSources's createAudioObject argument to download

This commit is contained in:
toasted-nutbread 2019-10-12 23:04:32 -04:00
parent 21a2730cde
commit 54d4c65854
3 changed files with 4 additions and 4 deletions

View File

@ -163,7 +163,7 @@ async function audioInject(definition, fields, sources, optionsContext) {
audioSourceDefinition = definition.expressions[0]; audioSourceDefinition = definition.expressions[0];
} }
const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, false); const {url} = await audioGetFromSources(audioSourceDefinition, sources, optionsContext, true);
if (url !== null) { if (url !== null) {
const filename = audioBuildFilename(audioSourceDefinition); const filename = audioBuildFilename(audioSourceDefinition);
if (filename !== null) { if (filename !== null) {

View File

@ -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}`; const key = `${expression.expression}:${expression.reading}`;
if (cache !== null && cache.hasOwnProperty(expression)) { if (cache !== null && cache.hasOwnProperty(expression)) {
return cache[key]; return cache[key];
@ -46,7 +46,7 @@ async function audioGetFromSources(expression, sources, optionsContext, createAu
} }
try { try {
const audio = createAudioObject ? await audioGetFromUrl(url) : null; const audio = download ? null : await audioGetFromUrl(url);
const result = {audio, url, source}; const result = {audio, url, source};
if (cache !== null) { if (cache !== null) {
cache[key] = result; cache[key] = result;

View File

@ -500,7 +500,7 @@ class Display {
} }
const sources = this.options.audio.sources; 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; let info;
if (audio === null) { if (audio === null) {
if (this.audioFallback === null) { if (this.audioFallback === null) {