Fix for missing language tag

This commit is contained in:
Rick Meijer 2021-05-04 12:35:55 +02:00
parent cac1c91bc2
commit 7d6157da31
No known key found for this signature in database
GPG key ID: D39390C5D0A56666

View file

@ -13,22 +13,22 @@ const details = () => ({
falls back to '[imdb-ttDIGITS] in the filename.`, falls back to '[imdb-ttDIGITS] in the filename.`,
Version: '1.00', Version: '1.00',
Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/' Link: 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/'
+ 'Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js', + 'Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js',
Tags: 'pre-processing,configurable', Tags: 'pre-processing,configurable',
Inputs: [ Inputs: [
{ {
name: 'user_langs', name: 'user_langs',
tooltip: 'Input a comma separated list of ISO-639-2 languages. It will still keep English and undefined tracks.' tooltip: 'Input a comma separated list of ISO-639-2 languages. It will still keep English and undefined tracks.'
+ '(https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes 639-2 column)' + '(https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes 639-2 column)'
+ '\\nExample:\\n' + '\\nExample:\\n'
+ 'nld,nor', + 'nld,nor',
}, },
{ {
name: 'priority', name: 'priority',
tooltip: 'Priority for either Radarr or Sonarr. Leaving it empty defaults to Radarr first.' tooltip: 'Priority for either Radarr or Sonarr. Leaving it empty defaults to Radarr first.'
+ '\\nExample:\\n' + '\\nExample:\\n'
+ 'sonarr', + 'sonarr',
}, },
{ {
name: 'api_key', name: 'api_key',
@ -41,8 +41,8 @@ const details = () => ({
{ {
name: 'radarr_url', name: 'radarr_url',
tooltip: 'Input your Radarr url here. (Without http://). Do include the port.' tooltip: 'Input your Radarr url here. (Without http://). Do include the port.'
+ '\\nExample:\\n' + '\\nExample:\\n'
+ '192.168.1.2:7878', + '192.168.1.2:7878',
}, },
{ {
name: 'sonarr_api_key', name: 'sonarr_api_key',
@ -51,8 +51,8 @@ const details = () => ({
{ {
name: 'sonarr_url', name: 'sonarr_url',
tooltip: 'Input your Sonarr url here. (Without http://). Do include the port.' tooltip: 'Input your Sonarr url here. (Without http://). Do include the port.'
+ '\\nExample:\\n' + '\\nExample:\\n'
+ '192.168.1.2:8989', + '192.168.1.2:8989',
}, },
], ],
}); });
@ -114,14 +114,18 @@ const processStreams = (result, file, user_langs) => {
// eslint-disable-next-line no-continue // eslint-disable-next-line no-continue
continue; continue;
} }
if (langs.includes(stream.tags.language)) { if (stream.tags.language) {
tracks.keep.push(streamIndex); if (langs.includes(stream.tags.language)) {
tracks.keep.push(streamIndex);
} else {
tracks.remove.push(streamIndex);
response.preset += `-map -0:a:${streamIndex} `;
tracks.remLangs += `${languages.getName(stream.tags.language, 'en')}, `;
}
streamIndex += 1;
} else { } else {
tracks.remove.push(streamIndex); response.infoLog += `☒No language tag found on audio track ${streamIndex}. Keeping it. \n`;
response.preset += `-map -0:a:${streamIndex} `;
tracks.remLangs += `${languages.getName(stream.tags.language, 'en')}, `;
} }
streamIndex += 1;
} }
} }
response.preset += ' -c copy -max_muxing_queue_size 9999'; response.preset += ' -c copy -max_muxing_queue_size 9999';