fix missing jpod101 audio

This commit is contained in:
wareya committed 2018-10-23 04:17:12 -04:00
1 parent 2dfe21f051
commit f403640ccd
2 files changed
+2003 -8

No files matched your search

+17 -8
View File
@@ -105,8 +105,6 @@ let lookup_kana = new Map();
let dictsloaded = 0; let dictsloaded = 0;
let lookup_audio = new Set();
function builddict() function builddict()
{ {
if (this.readyState === 4) if (this.readyState === 4)
@@ -121,6 +119,9 @@ function builddict()
} }
} }
let lookup_audio = new Set();
let lookup_audio_broken = new Map();
function build_audio_table() function build_audio_table()
{ {
if (this.readyState === 4) if (this.readyState === 4)
@@ -131,10 +132,18 @@ function build_audio_table()
let j = 0; let j = 0;
while ((j = this.responseText.indexOf("\n", i)) !== -1) while ((j = this.responseText.indexOf("\n", i)) !== -1)
{ {
lookup_audio.add(this.responseText.substring(i, j)); let text = this.responseText.substring(i, j);
if(!text.includes(","))
lookup_audio.add(text);
else
lookup_audio_broken.set(text.split(",")[1], text.split(",")[0]);
i = j + 1; i = j + 1;
} }
lookup_audio.add(this.responseText.substring(i)); let text = this.responseText.substring(i, j);
if(!text.includes(","))
lookup_audio.add(text);
else
lookup_audio_broken.set(text.split(",")[1], text.split(",")[0]);
} }
else else
console.error(xhr.statusText); console.error(xhr.statusText);
@@ -1405,9 +1414,9 @@ function add_extra_info(results)
for(let r of entry.r_ele) for(let r of entry.r_ele)
{ {
if(lookup_audio.has(r.reb)) if(lookup_audio.has(r.reb))
{
entry.has_audio.push(r.reb); entry.has_audio.push(r.reb);
} else if(lookup_audio_broken.has(r.reb))
entry.has_audio.push(lookup_audio_broken.get(r.reb));
} }
} }
else if(entry.k_ele) else if(entry.k_ele)
@@ -1418,9 +1427,9 @@ function add_extra_info(results)
{ {
let test_string = r.reb + ";" + k.keb; let test_string = r.reb + ";" + k.keb;
if(lookup_audio.has(test_string)) if(lookup_audio.has(test_string))
{
entry.has_audio.push(test_string); entry.has_audio.push(test_string);
} else if(lookup_audio_broken.has(test_string))
entry.has_audio.push(lookup_audio_broken.get(test_string));
} }
} }
} }
+1986
View File
File diff suppressed because it is too large. Load diff