forked from HaveAGitGat/Tdarr_Plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTdarr_Plugin_00td_action_add_audio_stream_codec.js
More file actions
103 lines (97 loc) · 2.62 KB
/
Copy pathTdarr_Plugin_00td_action_add_audio_stream_codec.js
File metadata and controls
103 lines (97 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const details = () => ({
id: 'Tdarr_Plugin_00td_action_add_audio_stream_codec',
Stage: 'Pre-processing',
Name: 'Add Audio Stream Codec',
Type: 'Video',
Operation: 'Transcode',
Description: `
This action has a built-in filter. Additional filters can be added above. \n\n
If the following audio track does not exist, Tdarr will try to add it using existing audio streams.
Tdarr will try to create the specified audio stream from the highest channel count stream
available in the specified language.
If no specified language track exists, the best untagged/undefined stream will be used.
`,
Version: '1.00',
Tags: 'action',
Inputs: [
{
name: 'audioCodec',
type: 'string',
defaultValue: 'aac',
inputUI: {
type: 'dropdown',
options: [
'aac',
'ac3',
'eac3',
'dca',
'flac',
'mp2',
'libmp3lame',
'truehd',
],
},
tooltip:
'Enter the desired audio codec',
},
{
name: 'language',
type: 'string',
defaultValue: 'en',
inputUI: {
type: 'text',
},
tooltip:
'Tdarr will check to see if the stream language tag includes the tag you specify.'
+ ' Case-insensitive. One tag only',
},
{
name: 'channels',
type: 'number',
defaultValue: 2,
inputUI: {
type: 'dropdown',
options: [
'1',
'2',
'6',
'8',
],
},
tooltip:
'Enter the desired number of channels',
},
],
});
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
preset: '',
container: '',
handBrakeMode: false,
FFmpegMode: false,
reQueueAfter: false,
infoLog: '',
};
const { audioCodec, language, channels } = inputs;
const transcodeAddAudioStream = lib.actions.transcodeAddAudioStream(
file,
audioCodec,
language,
channels,
);
response.preset = transcodeAddAudioStream.preset;
response.container = `.${file.container}`;
response.handbrakeMode = false;
response.ffmpegMode = true;
response.reQueueAfter = true;
response.processFile = transcodeAddAudioStream.processFile;
response.infoLog += transcodeAddAudioStream.note;
return response;
};
module.exports.details = details;
module.exports.plugin = plugin;