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 = {
|
const languageMapping = {
|
||||||
'dubbed': 'Dubbed',
|
'dubbed': 'Dubbed',
|
||||||
'multi': 'Multi',
|
'multi audio': 'Multi Audio',
|
||||||
|
'multi subs': 'Multi Subs',
|
||||||
|
'dual audio': 'Dual Audio',
|
||||||
'english': '🇬🇧',
|
'english': '🇬🇧',
|
||||||
'japanese': '🇯🇵',
|
'japanese': '🇯🇵',
|
||||||
'korean': '🇰🇷',
|
'korean': '🇰🇷',
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ function getQuality(record, torrentInfo, fileInfo) {
|
|||||||
function getLanguages(record, torrentInfo, fileInfo) {
|
function getLanguages(record, torrentInfo, fileInfo) {
|
||||||
const providerLanguages = record.torrent.languages && titleParser.parse(record.torrent.languages).languages || [];
|
const providerLanguages = record.torrent.languages && titleParser.parse(record.torrent.languages).languages || [];
|
||||||
const torrentLanguages = torrentInfo.languages || [];
|
const torrentLanguages = torrentInfo.languages || [];
|
||||||
|
const dubbed = torrentInfo.dubbed || fileInfo.dubbed;
|
||||||
let languages = [].concat(torrentLanguages).concat(providerLanguages);
|
let languages = [].concat(torrentLanguages).concat(providerLanguages);
|
||||||
if (record.kitsuId || record.torrent.type === Type.ANIME) {
|
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
|
// no need to display japanese for anime or english if anime is dubbed
|
||||||
languages = languages.concat(dubbed ? ['dubbed'] : [])
|
languages = languages.concat(dubbed ? ['dubbed'] : [])
|
||||||
.filter(lang => lang !== 'japanese')
|
.filter(lang => lang !== 'japanese')
|
||||||
@@ -65,6 +65,10 @@ function getLanguages(record, torrentInfo, fileInfo) {
|
|||||||
// no need to display languages if only english is present
|
// no need to display languages if only english is present
|
||||||
languages = [];
|
languages = [];
|
||||||
}
|
}
|
||||||
|
if (languages.length === 0 && dubbed) {
|
||||||
|
// display dubbed only if there are no other languages defined for non anime
|
||||||
|
languages = ['dubbed'];
|
||||||
|
}
|
||||||
return mapLanguages(languages);
|
return mapLanguages(languages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
4
addon/package-lock.json
generated
4
addon/package-lock.json
generated
@@ -1599,8 +1599,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"parse-torrent-title": {
|
"parse-torrent-title": {
|
||||||
"version": "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#9e751ef6e0b4adb31d306d618c92f9feb84963bb",
|
"from": "git://github.com/TheBeastLT/parse-torrent-title.git#6f837b460175695757395a0e1b40f760a40f0f59",
|
||||||
"requires": {
|
"requires": {
|
||||||
"moment": "^2.24.0"
|
"moment": "^2.24.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
"named-queue": "^2.2.1",
|
"named-queue": "^2.2.1",
|
||||||
"needle": "^2.2.4",
|
"needle": "^2.2.4",
|
||||||
"magnet-uri": "^5.1.7",
|
"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": "^7.8.2",
|
||||||
"pg-hstore": "^2.3.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",
|
"sequelize": "^4.43.0",
|
||||||
"stremio-addon-sdk": "^1.6.1",
|
"stremio-addon-sdk": "^1.6.1",
|
||||||
"user-agents": "^1.0.559"
|
"user-agents": "^1.0.559"
|
||||||
|
|||||||
Reference in New Issue
Block a user