mirror of
https://github.com/knightcrawler-stremio/knightcrawler.git
synced 2024-12-20 03:29:51 +00:00
[addon] updates multi/dual languages handling
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
const languageMapping = {
|
||||
'dubbed': 'Dubbed',
|
||||
'multi': 'Multi',
|
||||
'multi audio': 'Multi Audio',
|
||||
'multi subs': 'Multi Subs',
|
||||
'dual audio': 'Dual Audio',
|
||||
'english': '🇬🇧',
|
||||
'japanese': '🇯🇵',
|
||||
'korean': '🇰🇷',
|
||||
|
||||
@@ -53,9 +53,9 @@ function getQuality(record, torrentInfo, fileInfo) {
|
||||
function getLanguages(record, torrentInfo, fileInfo) {
|
||||
const providerLanguages = record.torrent.languages && titleParser.parse(record.torrent.languages).languages || [];
|
||||
const torrentLanguages = torrentInfo.languages || [];
|
||||
const dubbed = torrentInfo.dubbed || fileInfo.dubbed;
|
||||
let languages = [].concat(torrentLanguages).concat(providerLanguages);
|
||||
if (record.kitsuId || record.torrent.type === Type.ANIME) {
|
||||
const dubbed = torrentInfo.dubbed || fileInfo.dubbed || languages.includes('multi');
|
||||
// no need to display japanese for anime or english if anime is dubbed
|
||||
languages = languages.concat(dubbed ? ['dubbed'] : [])
|
||||
.filter(lang => lang !== 'japanese')
|
||||
@@ -65,6 +65,10 @@ function getLanguages(record, torrentInfo, fileInfo) {
|
||||
// no need to display languages if only english is present
|
||||
languages = [];
|
||||
}
|
||||
if (languages.length === 0 && dubbed) {
|
||||
// display dubbed only if there are no other languages defined for non anime
|
||||
languages = ['dubbed'];
|
||||
}
|
||||
return mapLanguages(languages);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user