exclude english from language filter

This commit is contained in:
TheBeastLT
2022-05-04 17:07:03 +02:00
parent c2e1d5ba49
commit e3dc850188
2 changed files with 5 additions and 4 deletions

View File

@@ -282,7 +282,7 @@ function landingTemplate(manifest, config = {}) {
${sortOptionsHTML} ${sortOptionsHTML}
</select> </select>
<label class="label" for="iLanguage">Priority language:</label> <label class="label" for="iLanguage">Priority foreign language:</label>
<select id="iLanguage" class="input" onchange="generateInstallLink()" title="Streams with the selected dubs/subs language will be shown on the top"> <select id="iLanguage" class="input" onchange="generateInstallLink()" title="Streams with the selected dubs/subs language will be shown on the top">
<option value="none" selected>None</option> <option value="none" selected>None</option>
${languageOptionsHTML} ${languageOptionsHTML}

View File

@@ -31,15 +31,16 @@ const SortOptions = {
} }
const LanguageOptions = { const LanguageOptions = {
key: 'language', key: 'language',
options: languages.map(lang => ({ options: languages.slice(1).map(lang => ({
key: lang, key: lang,
label: lang.charAt(0).toUpperCase() + lang.substr(1) label: lang.charAt(0).toUpperCase() + lang.slice(1)
})) }))
} }
function sortStreams(streams, config) { function sortStreams(streams, config) {
const language = config[LanguageOptions.key]; const language = config[LanguageOptions.key];
if (language) { if (language && language !== languages[0]) {
// No need to filter english since it's hard to predict which entries are english
const streamsWithLanguage = streams.filter(stream => containsLanguage(stream, language)); const streamsWithLanguage = streams.filter(stream => containsLanguage(stream, language));
const streamsNoLanguage = streams.filter(stream => !streamsWithLanguage.includes(stream)); const streamsNoLanguage = streams.filter(stream => !streamsWithLanguage.includes(stream));
return _sortStreams(streamsWithLanguage, config).concat(_sortStreams(streamsNoLanguage, config)); return _sortStreams(streamsWithLanguage, config).concat(_sortStreams(streamsNoLanguage, config));