order audio tracks based on --dubLang

This commit is contained in:
MikoGome 2025-08-18 05:54:05 -07:00
parent 34854358f3
commit e70dd907fd

View file

@ -2683,6 +2683,11 @@ export default class Crunchy implements ServiceClass {
item.langs.push(langsData.languages.find(a => a.cr_locale == version.audio_locale) as langsData.LanguageItem);
}
}
//Sort audio tracks according to the order of languages passed to the 'dubLang' option
const argv = yargs.appArgv(this.cfg.cli);
if(!argv.allDubs) {
item.langs.sort((a,b) => argv.dubLang.indexOf(a.code) - argv.dubLang.indexOf(b.code));
}
} else {
//Episode didn't have versions, mark it as such to be logged.
serieshasversions = false;