mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
exclude english from language filter
This commit is contained in:
@@ -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}
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user