mirror of
https://github.com/anidl/multi-downloader-nx.git
synced 2026-03-11 17:45:30 +00:00
Merge pull request #1037 from Sipherdrakon/Sipherdrakon-add-undetermined-audio-selection
[HD] Add undetermined audio selection and revert fallback
This commit is contained in:
commit
39e9c369e6
2 changed files with 4 additions and 14 deletions
15
hidive.ts
15
hidive.ts
|
|
@ -760,19 +760,8 @@ export default class Hidive implements ServiceClass {
|
|||
}
|
||||
}
|
||||
if (chosenAudios.length == 0) {
|
||||
console.warn(`Chosen audio language(s) does not exist for episode ${selectedEpisode.episodeInformation.episodeNumber}, falling back to first available audio`);
|
||||
if (audios.length > 0) {
|
||||
let chosenAudioQuality = options.q === 0 ? audios.length : options.q;
|
||||
if(chosenAudioQuality > audios.length) {
|
||||
chosenAudioQuality = audios.length;
|
||||
}
|
||||
chosenAudioQuality--;
|
||||
chosenAudios.push(audios[chosenAudioQuality]);
|
||||
console.info(`Using audio track: ${audios[chosenAudioQuality].language.code || 'unknown'}`);
|
||||
} else {
|
||||
console.error(`No audio tracks available for episode ${selectedEpisode.episodeInformation.episodeNumber}`);
|
||||
return undefined;
|
||||
}
|
||||
console.error(`Chosen audio language(s) does not exist for episode ${selectedEpisode.episodeInformation.episodeNumber}`);
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const fileName = parseFileName(options.fileName, variables, options.numbers, options.override).join(path.sep);
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ const languages: LanguageItem[] = [
|
|||
{ cr_locale: 'id-ID', locale: 'id-ID', code: 'ind', name: 'Indonesian', language: 'Bahasa Indonesia' },
|
||||
{ cr_locale: 'te-IN', locale: 'te-IN', code: 'tel', name: 'Telugu (India)', language: 'తెలుగు' },
|
||||
{ cr_locale: 'ja-JP', adn_locale: 'ja', ao_locale: 'ja', hd_locale: 'Japanese', locale: 'ja', code: 'jpn', name: 'Japanese' },
|
||||
{ locale: 'un', code: 'und', name: 'Undetermined', language: 'Undetermined', new_hd_locale: 'und', cr_locale: 'und', adn_locale: 'und', ao_locale: 'und' },
|
||||
];
|
||||
|
||||
// add en language names
|
||||
|
|
@ -97,7 +98,7 @@ const fixLanguageTag = (tag: string) => {
|
|||
// find lang by cr_locale
|
||||
const findLang = (cr_locale: string) => {
|
||||
const lang = languages.find(l => { return l.cr_locale == cr_locale; });
|
||||
return lang ? lang : { cr_locale: 'und', locale: 'un', code: 'und', name: '', language: '' };
|
||||
return lang ? lang : languages.find(l => l.code === 'und') || { cr_locale: 'und', locale: 'un', code: 'und', name: 'Undetermined', language: 'Undetermined' };
|
||||
};
|
||||
|
||||
const fixAndFindCrLC = (cr_locale: string) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue