[addon] updates multi/dual languages handling

This commit is contained in:
TheBeastLT
2020-04-25 11:25:21 +02:00
parent 10615e4aed
commit 5e72683ce4
4 changed files with 12 additions and 6 deletions

View File

@@ -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': '🇰🇷',

View File

@@ -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);
}

View File

@@ -1599,8 +1599,8 @@
}
},
"parse-torrent-title": {
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#9e751ef6e0b4adb31d306d618c92f9feb84963bb",
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#9e751ef6e0b4adb31d306d618c92f9feb84963bb",
"version": "git://github.com/TheBeastLT/parse-torrent-title.git#6f837b460175695757395a0e1b40f760a40f0f59",
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#6f837b460175695757395a0e1b40f760a40f0f59",
"requires": {
"moment": "^2.24.0"
}

View File

@@ -14,10 +14,10 @@
"named-queue": "^2.2.1",
"needle": "^2.2.4",
"magnet-uri": "^5.1.7",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#9e751ef6e0b4adb31d306d618c92f9feb84963bb",
"parse-torrent-title": "git://github.com/TheBeastLT/parse-torrent-title.git#6f837b460175695757395a0e1b40f760a40f0f59",
"pg": "^7.8.2",
"pg-hstore": "^2.3.2",
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#9e751ef6e0b4adb31d306d618c92f9feb84963bb",
"real-debrid-api": "git://github.com/TheBeastLT/node-real-debrid.git#935a5c23ae809edbcd2a111526a7f74d6767c50d",
"sequelize": "^4.43.0",
"stremio-addon-sdk": "^1.6.1",
"user-agents": "^1.0.559"