diff --git a/Community/Tdarr_Plugin_00td_action_add_audio_stream_codec.js b/Community/Tdarr_Plugin_00td_action_add_audio_stream_codec.js new file mode 100644 index 0000000..ed5260b --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_add_audio_stream_codec.js @@ -0,0 +1,104 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_add_audio_stream_codec', + Stage: 'Pre-processing', + Name: 'Standardise audio stream codecs', + 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 no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line 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; diff --git a/Community/Tdarr_Plugin_00td_action_handbrake_basic_options.js b/Community/Tdarr_Plugin_00td_action_handbrake_basic_options.js new file mode 100644 index 0000000..6254746 --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_handbrake_basic_options.js @@ -0,0 +1,185 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_handbrake_basic_options', + Stage: 'Pre-processing', + Name: 'HandBrake basic options', + Type: 'Video', + Operation: 'Transcode', + Description: ` + Set basic HandBrake transcode options. This action has no built-in filter so be sure to set a codec filter + to prevent a transcoding loop. + `, + Version: '1.00', + Tags: 'action', + Inputs: [ + { + name: 'handbrakePreset', + type: 'string', + defaultValue: 'Very Fast 1080p30', + inputUI: { + type: 'dropdown', + options: [ + 'Very Fast 1080p30', + 'Very Fast 720p30', + 'Very Fast 576p25', + 'Very Fast 480p30', + 'Fast 1080p30', + 'Fast 720p30', + 'Fast 576p25', + 'Fast 480p30', + 'HQ 1080p30 Surround', + 'HQ 720p30 Surround', + 'HQ 576p25 Surround', + 'HQ 480p30 Surround"', + 'Super HQ 1080p30 Surround', + 'Super HQ 720p30 Surround', + 'Super HQ 576p25 Surround', + 'Super HQ 480p30 Surround', + 'Gmail Large 3 Minutes 720p30', + 'Gmail Medium 5 Minutes 480p30', + 'Gmail Small 10 Minutes 288p30', + 'Vimeo YouTube HQ 2160p60 4K', + 'Vimeo YouTube HQ 1440p60 2.5K', + 'Vimeo YouTube HQ 1080p60', + 'Vimeo YouTube HQ 720p60', + 'Vimeo YouTube 720p30', + 'Android 1080p30', + 'Android 720p30', + 'Android 576p25', + 'Android 480p30', + 'Apple 2160p60 4K HEVC Surround', + 'Apple 1080p60 Surround', + 'Apple 1080p30 Surround', + 'Apple 720p30 Surround', + 'Apple 540p30 Surround', + 'Apple 240p30', + 'Chromecast 2160p60 4K HEVC Surround', + 'Chromecast 1080p60 Surround', + 'Chromecast 1080p30 Surround', + 'Amazon Fire 2160p60 4K HEVC Surround', + 'Amazon Fire 1080p30 Surround', + 'Amazon Fire 720p30', + 'Playstation 1080p30 Surround', + 'Playstation 720p30', + 'Playstation 540p30', + 'Roku 2160p60 4K HEVC Surround', + 'Roku 1080p30 Surround', + 'Roku 720p30 Surround', + 'Roku 576p25', + 'Roku 480p30', + 'Windows Mobile 1080p30', + 'Windows Mobile 720p30', + 'Windows Mobile 540p30', + 'Windows Mobile 480p30', + 'Xbox 1080p30 Surround', + 'Xbox Legacy 1080p30 Surround', + 'H.265 MKV 2160p60', + 'H.265 MKV 1080p30', + 'H.265 MKV 720p30', + 'H.265 MKV 576p25', + 'H.265 MKV 480p30', + 'H.264 MKV 2160p60', + 'H.264 MKV 1080p30', + 'H.264 MKV 720p30', + 'H.264 MKV 576p25', + 'H.264 MKV 480p30', + 'VP9 MKV 2160p60', + 'VP9 MKV 1080p30', + 'VP9 MKV 720p30', + 'VP9 MKV 576p25', + 'VP9 MKV 480p30', + 'VP8 MKV 1080p30', + 'VP8 MKV 720p30', + 'VP8 MKV 576p25', + 'VP8 MKV 480p30', + 'Production Max', + 'Production Standard', + 'Production Proxy 1080p', + 'Production Proxy 540p', + ], + }, + tooltip: + 'Enter the desired HandBrake preset', + }, + { + name: 'videoEncoder', + type: 'string', + defaultValue: 'x265', + inputUI: { + type: 'dropdown', + options: [ + 'x264', + 'x264_10bit', + 'qsv_h264', + 'nvenc_h264', + 'x265', + 'x265_10bit', + 'x265_12bit', + 'qsv_h265', + 'nvenc_h265', + 'mpeg4', + 'mpeg2', + 'VP8', + 'VP9', + 'theora', + ], + }, + tooltip: + 'Enter the desired video encoder', + }, + { + name: 'keepSubtitles', + type: 'boolean', + defaultValue: true, + inputUI: { + type: 'dropdown', + options: [ + 'true', + 'false', + ], + }, + tooltip: + 'Specify whether to keep subs or not', + }, + { + name: 'container', + type: 'string', + defaultValue: 'mkv', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the desired container', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line 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 keepSubs = inputs.keepSubtitles === true ? '--all-subtitles' : ''; + + response.preset = `-Z "${inputs.handbrakePreset}" -e ${inputs.videoEncoder} ${keepSubs}`; + response.container = `.${inputs.container}`; + response.handbrakeMode = true; + response.ffmpegMode = false; + response.reQueueAfter = true; + response.processFile = true; + response.infoLog += 'File is being transcoded using HandBrake \n'; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js b/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js new file mode 100644 index 0000000..fff8f9d --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js @@ -0,0 +1,105 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom', + Stage: 'Pre-processing', + Name: 'HandBrake or FFmpeg custom arguments', + Type: 'Video', + Operation: 'Transcode', + Description: ` + Set HandBrake or FFmpeg arguments. This action has no built-in filter so be sure to set a codec filter + to prevent a transcoding loop. + `, + Version: '1.00', + Tags: 'action', + Inputs: [ + { + name: 'cli', + type: 'string', + defaultValue: 'ffmpeg', + inputUI: { + type: 'dropdown', + options: [ + 'ffmpeg', + 'handbrake', + ], + }, + tooltip: + 'Enter the desired video encoder', + }, + { + name: 'arguments', + type: 'string', + defaultValue: ' -map 0 -c copy', + inputUI: { + type: 'text', + }, + tooltip: + ` +When using FFmpeg, you need to separate the input and output args with . FFmpeg Examples: +\n\n +-r 1-r 24 +\n\n +-sn -c:v copy -c:a copy +\n\n +-c:v libx265 -crf 23 -ac 6 -c:a aac -preset veryfast +\n\n +-map 0 -c copy -c:v libx265 -c:a aac +\n\n +-c:v h264_cuvid-c:v hevc_nvenc -preset slow -c:a copy + +\n\n +HandBrake examples: +\n\n +-e x264 -q 20 -B +\n\n +-Z "Very Fast 1080p30" +\n\n +-Z "Fast 1080p30" -e nvenc_h265 +\n\n +-Z "Very Fast 1080p30" --all-subtitles --all-audio +\n\n +-Z "Very Fast 480p30" +\n\n +--preset-import-file "C:/Users/HaveAGitGat/Desktop/testpreset.json" -Z "My Preset" +`, + }, + { + name: 'container', + type: 'string', + defaultValue: 'mkv', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the desired container', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + preset: '', + container: '', + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + }; + + response.preset = inputs.arguments; + response.container = `.${inputs.container}`; + response.handbrakeMode = inputs.cli === 'handbrake'; + response.ffmpegMode = inputs.cli === 'ffmpeg'; + response.reQueueAfter = true; + response.processFile = true; + response.infoLog += 'File is being transcoded using custom arguments \n'; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_action_keep_one_audio_stream.js b/Community/Tdarr_Plugin_00td_action_keep_one_audio_stream.js new file mode 100644 index 0000000..d7d4e6b --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_keep_one_audio_stream.js @@ -0,0 +1,103 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_keep_one_audio_stream', + Stage: 'Pre-processing', + Name: 'Keep one audio stream', + Type: 'Video', + Operation: 'Transcode', + Description: ` +This action has a built-in filter. Additional filters can be added.\n\n + +Tdarr will try to keep the best audio track possible given the requirements specified below. +If the specified stream does not exist, Tdarr will try to create it using the best stream available. +If no specified language track exists, the best untagged/undefined stream will be used/kept. + `, + 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 no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + preset: '', + container: `.${file.container}`, + handBrakeMode: false, + FFmpegMode: false, + reQueueAfter: false, + infoLog: '', + }; + + const { audioCodec, language, channels } = inputs; + + const transcodeKeepOneAudioStream = lib.actions.transcodeKeepOneAudioStream( + file, + audioCodec, + language, + channels, + ); + + response.preset = transcodeKeepOneAudioStream.preset; + response.container = `.${file.container}`; + response.handbrakeMode = false; + response.FFmpegMode = true; + response.reQueueAfter = true; + response.processFile = transcodeKeepOneAudioStream.processFile; + response.infoLog += transcodeKeepOneAudioStream.note; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_action_remux_container.js b/Community/Tdarr_Plugin_00td_action_remux_container.js new file mode 100644 index 0000000..58282eb --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_remux_container.js @@ -0,0 +1,62 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_remux_container', + Stage: 'Pre-processing', + Name: 'Remux container', + Type: 'Video', + Operation: 'Transcode', + Description: ` + This action has a built-in filter. Additional filters can be added.\n\n + + If not in the specified container, the file will be remuxed. + `, + Version: '1.00', + Tags: 'action', + Inputs: [ + { + name: 'container', + type: 'string', + defaultValue: 'mkv', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the desired container', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line 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 { container } = inputs; + + const remuxContainer = lib.actions.remuxContainer( + file, + container, + ); + + response.preset = ', -map 0 -c copy'; + response.container = '.mkv'; + response.handbrakeMode = false; + response.FFmpegMode = true; + response.reQueueAfter = true; + response.processFile = remuxContainer.processFile; + response.infoLog += remuxContainer.note; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_action_standardise_audio_stream_codecs.js b/Community/Tdarr_Plugin_00td_action_standardise_audio_stream_codecs.js new file mode 100644 index 0000000..9e3cd64 --- /dev/null +++ b/Community/Tdarr_Plugin_00td_action_standardise_audio_stream_codecs.js @@ -0,0 +1,71 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_action_standardise_audio_stream_codecs', + Stage: 'Pre-processing', + Name: 'Standardise audio stream codecs', + Type: 'Video', + Operation: 'Transcode', + Description: ` +This action has a built-in filter. Additional filters can be added.\n\n + +All audio tracks which are not in the specified codec will be transcoded +into the specified codec. Bitrate and channel count are kept the same. + `, + 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', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line 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 transcodeStandardiseAudioCodecs = lib.actions.transcodeStandardiseAudioCodecs( + file, + inputs.audioCodec, + ); + + response.preset = transcodeStandardiseAudioCodecs.preset; + response.container = `.${file.container}`; + response.handbrakeMode = false; + response.ffmpegMode = true; + response.reQueueAfter = true; + response.processFile = transcodeStandardiseAudioCodecs.processFile; + response.infoLog += transcodeStandardiseAudioCodecs.note; + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_filter_by_bitrate.js b/Community/Tdarr_Plugin_00td_filter_by_bitrate.js new file mode 100644 index 0000000..9825e6e --- /dev/null +++ b/Community/Tdarr_Plugin_00td_filter_by_bitrate.js @@ -0,0 +1,60 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_filter_by_bitrate', + Stage: 'Pre-processing', + Name: 'Filter by bitrate', + Type: 'Video', + Operation: 'Filter', + Description: 'Only allow files to be transcoded which are within the lower and upper bounds (Kb) \n\n', + Version: '1.00', + Tags: 'filter', + Inputs: [ + { + name: 'upperBound', + type: 'number', + defaultValue: 10000, + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the upper bound bitrate in Kb for files which should be processed.', + }, + { + name: 'lowerBound', + type: 'number', + defaultValue: 0, + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the lower bound bitrate in Kb for files which should be processed.', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + infoLog: '', + }; + + if ( + file.bit_rate >= inputs.lowerBound * 1000 + && file.bit_rate <= inputs.upperBound * 1000 + ) { + response.processFile = true; + response.processFile += '☑File bitrate is within filter limits. Moving to next plugin.'; + } else { + response.processFile = false; + response.processFile += '☒File bitrate is not within filter limits. Breaking out of plugin stack.\n'; + return response; + } + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_filter_by_codec.js b/Community/Tdarr_Plugin_00td_filter_by_codec.js new file mode 100644 index 0000000..4ccc344 --- /dev/null +++ b/Community/Tdarr_Plugin_00td_filter_by_codec.js @@ -0,0 +1,73 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_filter_by_codec', + Stage: 'Pre-processing', + Name: 'Filter by codec', + Type: 'Video', + Operation: 'Filter', + Description: 'Only allow specified codecs to be processed \n\n', + Version: '1.00', + Tags: 'filter', + Inputs: [ + { + name: 'codecsToProcess', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter a comma separated list of codecs to be processed. Leave blank if using codecsToNotProcess', + }, + { + name: 'codecsToNotProcess', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter a comma separated list of codecs to be not be processed. Leave blank if using codecsToProcess', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + infoLog: '', + }; + + const fileCodec = file.video_codec_name !== '' ? file.video_codec_name : file.audio_codec_name; + + if (inputs.codecsToProcess !== '') { + const codecs = inputs.codecsToProcess.split(','); + if (codecs.includes(fileCodec)) { + response.processFile = true; + response.processFile += 'File is in codecsToProcess. Moving to next plugin.'; + } else { + response.processFile = false; + response.processFile += 'File is not in codecsToProcess. Breaking out of plugin stack.'; + } + } + + if (inputs.codecsToNotProcess !== '') { + const codecs = inputs.codecsToNotProcess.split(','); + if (codecs.includes(fileCodec)) { + response.processFile = false; + response.processFile += 'File is in codecsToNotProcess. Breaking out of plugin stack.'; + } else { + response.processFile = true; + response.processFile += 'File is not in codecsToNotProcess. Moving to next plugin.'; + } + } + + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_filter_by_resolution.js b/Community/Tdarr_Plugin_00td_filter_by_resolution.js new file mode 100644 index 0000000..ab8efec --- /dev/null +++ b/Community/Tdarr_Plugin_00td_filter_by_resolution.js @@ -0,0 +1,81 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_filter_by_resolution', + Stage: 'Pre-processing', + Name: 'Filter by resolution', + Type: 'Video', + Operation: 'Filter', + Description: 'Only allow specified resolutions to be processed \n\n', + Version: '1.00', + Tags: 'filter', + Inputs: [ + { + name: 'resolutionsToProcess', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: + `Enter a comma separated list of resolutions to be processed. + Leave blank if using resolutionsToNotProcess. + 480p,576p,720p,1080p,4KUHD,DCI4K,8KUHD,Other + `, + }, + { + name: 'resolutionsToNotProcess', + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: + 'Enter a comma separated list of resolutions to be not be processed.' + + ' Leave blank if using resolutionsToProcess', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + infoLog: '', + }; + + if (!file.video_resolution) { + throw new Error('File has no resolution!'); + } + + const fileResolution = file.video_resolution; + + if (inputs.resolutionsToProcess !== '') { + const resolutions = inputs.resolutionsToProcess.split(','); + if (resolutions.includes(fileResolution)) { + response.processFile = true; + response.processFile += 'File is in resolutionsToProcess. Moving to next plugin.'; + } else { + response.processFile = false; + response.processFile += 'File is not in resolutionsToProcess. Breaking out of plugin stack.'; + } + } + + if (inputs.resolutionsToNotProcess !== '') { + const resolutions = inputs.resolutionsToNotProcess.split(','); + if (resolutions.includes(fileResolution)) { + response.processFile = false; + response.processFile += 'File is in resolutionsToNotProcess. Breaking out of plugin stack.'; + } else { + response.processFile = true; + response.processFile += 'File is not in resolutionsToNotProcess. Moving to next plugin.'; + } + } + + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_00td_filter_by_size.js b/Community/Tdarr_Plugin_00td_filter_by_size.js new file mode 100644 index 0000000..1f235ab --- /dev/null +++ b/Community/Tdarr_Plugin_00td_filter_by_size.js @@ -0,0 +1,57 @@ +const details = () => ({ + id: 'Tdarr_Plugin_00td_filter_by_size', + Stage: 'Pre-processing', + Name: 'Filter by size', + Type: 'Video', + Operation: 'Filter', + Description: 'Only allow files to be transcoded which are within the lower and upper bounds (MB) \n\n', + Version: '1.00', + Tags: 'filter', + Inputs: [ + { + name: 'upperBound', + type: 'number', + defaultValue: 100000, + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the upper bound size in MB for files which should be processed.', + }, + { + name: 'lowerBound', + type: 'number', + defaultValue: 0, + inputUI: { + type: 'text', + }, + tooltip: + 'Enter the lower bound size in MB for files which should be processed.', + }, + ], +}); + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + const response = { + processFile: false, + infoLog: '', + }; + + const fileSize = file.file_size; + if (fileSize >= inputs.lowerBound && fileSize <= inputs.upperBound) { + response.processFile = true; + response.infoLog += 'File is within lower and upper bound size limits. Moving to next plugin.'; + } else { + response.infoLog += 'File is not within lower and upper bound size limits. Breaking out of plugin stack.'; + } + + return response; +}; + +module.exports.details = details; +module.exports.plugin = plugin; diff --git a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js index 167aadb..2bc065e 100644 --- a/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js +++ b/Community/Tdarr_Plugin_075a_FFMPEG_HEVC_Generic.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => ({ id: 'Tdarr_Plugin_075a_FFMPEG_HEVC_Generic', @@ -14,8 +13,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js index 57b5cbb..3fb7134 100644 --- a/Community/Tdarr_Plugin_075a_Transcode_Customisable.js +++ b/Community/Tdarr_Plugin_075a_Transcode_Customisable.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => ({ id: "Tdarr_Plugin_075a_Transcode_Customisable", @@ -153,8 +152,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js index 50b651e..7ea5116 100644 --- a/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js +++ b/Community/Tdarr_Plugin_075b_FFMPEG_HEVC_Generic_Video_Audio_Only.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js b/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js index 1ec38a2..59d4d65 100644 --- a/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js +++ b/Community/Tdarr_Plugin_075c_FFMPEG_HEVC_Generic_Video_Audio_Only_CRF20.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js b/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js index 021e641..607394b 100644 --- a/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js +++ b/Community/Tdarr_Plugin_075d_FFMPEG_HEVC_GPU_Generic_Video_Audio_Only_CRF20.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_076a_re_order_audio_streams.js b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js index 8186923..ca152a2 100644 --- a/Community/Tdarr_Plugin_076a_re_order_audio_streams.js +++ b/Community/Tdarr_Plugin_076a_re_order_audio_streams.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -44,8 +43,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js index 620cfea..93aa75f 100644 --- a/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js +++ b/Community/Tdarr_Plugin_076b_re_order_subtitle_streams.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -44,8 +43,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js b/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js index aa11e25..a715881 100644 --- a/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js +++ b/Community/Tdarr_Plugin_077b_HandBrake_NVENC_264_Configurable.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -58,8 +57,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js b/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js index 2c4d0e0..de1e214 100644 --- a/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js +++ b/Community/Tdarr_Plugin_078d_Output_embedded_subs_to_SRT_and_remove.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object at some point in the function else plugin will fail. let response = { diff --git a/Community/Tdarr_Plugin_43az_add_to_radarr.js b/Community/Tdarr_Plugin_43az_add_to_radarr.js index 66558fc..63c1795 100644 --- a/Community/Tdarr_Plugin_43az_add_to_radarr.js +++ b/Community/Tdarr_Plugin_43az_add_to_radarr.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -60,8 +59,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const request = require('request'); const IP = inputs.server_ip; const { port } = inputs; diff --git a/Community/Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only.js b/Community/Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only.js index 451fe76..15a130f 100644 --- a/Community/Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only.js +++ b/Community/Tdarr_Plugin_A47j_FFMPEG_NVENC_HEVC_Video_Only.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -147,8 +146,10 @@ function getMediaInfo(file) { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); if (file.fileMedium !== "video") { response.processFile = false; diff --git a/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js b/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js index b17193a..816b8d7 100644 --- a/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js +++ b/Community/Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll.js @@ -1,5 +1,5 @@ /* eslint-disable */ -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { id: "Tdarr_Plugin_DOOM_NVENC_Tiered_MKV_CleanAll", @@ -476,8 +476,10 @@ function buildVideoConfiguration(inputs, file, logger) { //#endregion // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { container: ".mkv", FFmpegMode: true, diff --git a/Community/Tdarr_Plugin_ER01_Transcode audio and video with HW (PC and Mac).js b/Community/Tdarr_Plugin_ER01_Transcode audio and video with HW (PC and Mac).js index 2809cd4..267e22c 100644 --- a/Community/Tdarr_Plugin_ER01_Transcode audio and video with HW (PC and Mac).js +++ b/Community/Tdarr_Plugin_ER01_Transcode audio and video with HW (PC and Mac).js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ /* eslint-disable */ /* eslint max-len: 0 */ @@ -73,8 +72,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { container: '.mkv', processFile: false, diff --git a/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js b/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js index 7a293e7..40dcfbd 100644 --- a/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_Greg_MP3_FFMPEG_CPU.js @@ -1,6 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); -const lib = require('../methods/library.js'); - module.exports.dependencies = ['import-fresh']; const details = () => ({ id: 'Tdarr_Plugin_Greg_MP3_FFMPEG_CPU', @@ -31,8 +28,10 @@ module.exports.details = details; // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { // 320K selected over 384k intentionally // https://en.m.wikipedia.org/wiki/MPEG-1#Part_3:_Audio diff --git a/Community/Tdarr_Plugin_JB69_JBHEVCQSV_MinimalFile.js b/Community/Tdarr_Plugin_JB69_JBHEVCQSV_MinimalFile.js index 9b1fe06..1c961b0 100644 --- a/Community/Tdarr_Plugin_JB69_JBHEVCQSV_MinimalFile.js +++ b/Community/Tdarr_Plugin_JB69_JBHEVCQSV_MinimalFile.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ ////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -168,8 +167,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { processFile: false, diff --git a/Community/Tdarr_Plugin_JB69_JBHEVCQSZ_PostFix.js b/Community/Tdarr_Plugin_JB69_JBHEVCQSZ_PostFix.js index 1fe383c..46b3cbd 100644 --- a/Community/Tdarr_Plugin_JB69_JBHEVCQSZ_PostFix.js +++ b/Community/Tdarr_Plugin_JB69_JBHEVCQSZ_PostFix.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ ////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -165,8 +164,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { processFile: false, diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 28e268c..fce1945 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz1FFMPEG', @@ -109,8 +108,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index 02d7969..fbebfd2 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz1FFMPEG_CPU', @@ -88,8 +87,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz1Remux.js b/Community/Tdarr_Plugin_MC93_Migz1Remux.js index 95125f9..2071c59 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1Remux.js +++ b/Community/Tdarr_Plugin_MC93_Migz1Remux.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz1Remux', @@ -51,8 +50,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 36f9a78..2383a4a 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz2CleanTitle', Stage: 'Pre-processing', @@ -67,8 +65,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js index 98749d5..64073f6 100644 --- a/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz3CleanAudio.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz3CleanAudio', @@ -88,8 +87,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js index daf8877..fced7c7 100644 --- a/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js +++ b/Community/Tdarr_Plugin_MC93_Migz4CleanSubs.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz4CleanSubs', @@ -63,8 +62,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js index 046bd2e..4ffc061 100644 --- a/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js +++ b/Community/Tdarr_Plugin_MC93_Migz5ConvertAudio.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz5ConvertAudio', @@ -45,8 +44,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, container: `.${file.container}`, diff --git a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js index c649e44..2ce684e 100644 --- a/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js +++ b/Community/Tdarr_Plugin_MC93_Migz6OrderStreams.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_Migz6OrderStreams', @@ -14,8 +13,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js b/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js index 6dc23f2..e573fb8 100644 --- a/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js +++ b/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ const details = () => ({ id: 'Tdarr_Plugin_MC93_MigzImageRemoval', @@ -14,8 +13,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js index d04a3df..f49735a 100644 --- a/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js +++ b/Community/Tdarr_Plugin_MC93_MigzPlex_Autoscan.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - module.exports.dependencies = [ 'request', ]; @@ -63,8 +61,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // eslint-disable-next-line global-require,import/no-unresolved const request = require('request'); diff --git a/Community/Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs.js b/Community/Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs.js index 3b5f0a1..64391ec 100644 --- a/Community/Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs.js +++ b/Community/Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs.js @@ -1,145 +1,145 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); -/* eslint-disable */ -const details = () => { - return { - id: "Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs", - Stage: "Pre-processing", - Name: "MichPass-Remove subtitle and audio streams with certain codecs", - Type: "Any", - Operation: 'Transcode', - Description: `This plugin removed specified codecs from subtitle and audio tracks. Helpful to remove bitmap subtitles (pgs,vobsub) or audio codec (truehd), which can cause Plex to start transcoding. Based on Migz4 Plugin. Thanks \n\n`, - Version: "1.0", - Tags: "pre-processing,ffmpeg,subtitle, audio,configurable", - - Inputs: [ - { - name: "tag_subtitle_codecs", - type: 'string', - defaultValue: '', - inputUI: { - type: 'text', - }, - tooltip: `Specify key words here for subtitle tracks you'd like to have removed. - \\nExample:\\n - hdmv_pgs_subtitle - \\nExample:\\n - hdmv_pgs_subtitle,dvd_subtitle`, - }, - { - - name: "tag_audio_codecs", - type: 'string', - defaultValue: '', - inputUI: { - type: 'text', - }, - tooltip: `Specify all audio codecs you'd like to have removed. - \\nExample:\\n - truehd - \\nExample:\\n - xxx,yyy`, - }, - ], - }; -} - -// eslint-disable-next-line no-unused-vars -const plugin = (file, librarySettings, inputs, otherArguments) => { - // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); - var response = { - processFile: false, - preset: "", - container: "." + file.container, - handBrakeMode: false, - FFmpegMode: true, - reQueueAfter: false, - infoLog: "", - - }; - - // Check if file is a video. If it isn't then exit plugin. - - if (file.fileMedium !== "video") { - console.log("File is not video"); - response.infoLog += "☒File is not video \n"; - response.processFile = false; - return response; - } - - - // Set up required variables. - var tag_subtitle_codecs = inputs.tag_subtitle_codecs.split(","); - var tag_audio_codecs = inputs.tag_audio_codecs.split(","); - var ffmpegCommandInsert = ""; - var subtitleIdx = 0; - var audioIdx = 0; - var convert = false; - - // Go through each stream in the file. - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - // Catch error here incase the title metadata is completely missing. - try { - // Check stream is subtitle AND stream codec contains certain words, removing these streams . - if ( - file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && - tag_subtitle_codecs.indexOf(file.ffProbeData.streams[i].codec_name.toLowerCase() - ) > -1 - ) { - ffmpegCommandInsert += `-map -0:s:${subtitleIdx} `; - response.infoLog += `☒Subtitle stream detected as unwanted. removing subtitle stream 0:s:${subtitleIdx} - ${file.ffProbeData.streams[i].tags.title} - ${file.ffProbeData.streams[i].codec_name}. \n`; - convert = true; - } - } catch (err) {} - - -// For debugging -// response.infoLog += `☒test tags codectype title - ${file.ffProbeData.streams[i].codec_type}. \n`; -// response.infoLog += `☒test tag name - ${file.ffProbeData.streams[i].codec_name}. \n`; -// response.infoLog += `☒test tags long name - ${file.ffProbeData.streams[i].codec_long_name}. \n`; - - try { - // Check if stream is audio . - if ( - file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && - tag_audio_codecs.indexOf(file.ffProbeData.streams[i].codec_name.toLowerCase() - ) > -1 - ) { - ffmpegCommandInsert += `-map -0:a:${audioIdx} `; - response.infoLog += `☒audio stream detected as unwanted. removing audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title} - ${file.ffProbeData.streams[i].codec_name} \n`; - convert = true; - } - } catch (err) {} - - - // Check if stream type is audio and increment audioIdx if true. - if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { - audioIdx++; - } - - // Check if stream type is subtitle and increment subtitleIdx if true. - if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { - subtitleIdx++; - } - } - - - // Convert file if convert variable is set to true. - - if (convert === true) { - response.processFile = true; - response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096`; - response.container = "." + file.container; - response.reQueueAfter = true; - } else { - response.processFile = false; - response.infoLog += - "☑File doesn't contain subtitle or audio codecs which were unwanted or that require tagging.\n"; - - } - return response; -} - +/* eslint-disable */ +const details = () => { + return { + id: "Tdarr_Plugin_MP01_MichPasCleanSubsAndAudioCodecs", + Stage: "Pre-processing", + Name: "MichPass-Remove subtitle and audio streams with certain codecs", + Type: "Any", + Operation: 'Transcode', + Description: `This plugin removed specified codecs from subtitle and audio tracks. Helpful to remove bitmap subtitles (pgs,vobsub) or audio codec (truehd), which can cause Plex to start transcoding. Based on Migz4 Plugin. Thanks \n\n`, + Version: "1.0", + Tags: "pre-processing,ffmpeg,subtitle, audio,configurable", + + Inputs: [ + { + name: "tag_subtitle_codecs", + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: `Specify key words here for subtitle tracks you'd like to have removed. + \\nExample:\\n + hdmv_pgs_subtitle + \\nExample:\\n + hdmv_pgs_subtitle,dvd_subtitle`, + }, + { + + name: "tag_audio_codecs", + type: 'string', + defaultValue: '', + inputUI: { + type: 'text', + }, + tooltip: `Specify all audio codecs you'd like to have removed. + \\nExample:\\n + truehd + \\nExample:\\n + xxx,yyy`, + }, + ], + }; +} + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + var response = { + processFile: false, + preset: "", + container: "." + file.container, + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: false, + infoLog: "", + + }; + + // Check if file is a video. If it isn't then exit plugin. + + if (file.fileMedium !== "video") { + console.log("File is not video"); + response.infoLog += "☒File is not video \n"; + response.processFile = false; + return response; + } + + + // Set up required variables. + var tag_subtitle_codecs = inputs.tag_subtitle_codecs.split(","); + var tag_audio_codecs = inputs.tag_audio_codecs.split(","); + var ffmpegCommandInsert = ""; + var subtitleIdx = 0; + var audioIdx = 0; + var convert = false; + + // Go through each stream in the file. + for (var i = 0; i < file.ffProbeData.streams.length; i++) { + // Catch error here incase the title metadata is completely missing. + try { + // Check stream is subtitle AND stream codec contains certain words, removing these streams . + if ( + file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && + tag_subtitle_codecs.indexOf(file.ffProbeData.streams[i].codec_name.toLowerCase() + ) > -1 + ) { + ffmpegCommandInsert += `-map -0:s:${subtitleIdx} `; + response.infoLog += `☒Subtitle stream detected as unwanted. removing subtitle stream 0:s:${subtitleIdx} - ${file.ffProbeData.streams[i].tags.title} - ${file.ffProbeData.streams[i].codec_name}. \n`; + convert = true; + } + } catch (err) {} + + +// For debugging +// response.infoLog += `☒test tags codectype title - ${file.ffProbeData.streams[i].codec_type}. \n`; +// response.infoLog += `☒test tag name - ${file.ffProbeData.streams[i].codec_name}. \n`; +// response.infoLog += `☒test tags long name - ${file.ffProbeData.streams[i].codec_long_name}. \n`; + + try { + // Check if stream is audio . + if ( + file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && + tag_audio_codecs.indexOf(file.ffProbeData.streams[i].codec_name.toLowerCase() + ) > -1 + ) { + ffmpegCommandInsert += `-map -0:a:${audioIdx} `; + response.infoLog += `☒audio stream detected as unwanted. removing audio stream 0:a:${audioIdx} - ${file.ffProbeData.streams[i].tags.title} - ${file.ffProbeData.streams[i].codec_name} \n`; + convert = true; + } + } catch (err) {} + + + // Check if stream type is audio and increment audioIdx if true. + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") { + audioIdx++; + } + + // Check if stream type is subtitle and increment subtitleIdx if true. + if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle") { + subtitleIdx++; + } + } + + + // Convert file if convert variable is set to true. + + if (convert === true) { + response.processFile = true; + response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy -max_muxing_queue_size 4096`; + response.container = "." + file.container; + response.reQueueAfter = true; + } else { + response.processFile = false; + response.infoLog += + "☑File doesn't contain subtitle or audio codecs which were unwanted or that require tagging.\n"; + + } + return response; +} module.exports.details = details; module.exports.plugin = plugin; \ No newline at end of file diff --git a/Community/Tdarr_Plugin_Mthr_VaapiHEVCTranscode.js b/Community/Tdarr_Plugin_Mthr_VaapiHEVCTranscode.js index 3cd026c..5263dc1 100644 --- a/Community/Tdarr_Plugin_Mthr_VaapiHEVCTranscode.js +++ b/Community/Tdarr_Plugin_Mthr_VaapiHEVCTranscode.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const vaapiPrefix = ` -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi `; @@ -44,8 +43,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { processFile: false, preset: ``, diff --git a/Community/Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation.js b/Community/Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation.js index f173abf..141e07e 100644 --- a/Community/Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation.js +++ b/Community/Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation.js @@ -1,232 +1,233 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); -/* eslint-disable */ -//PLugin runs multipass loudnorm filter -//first run gets the required details and stores for the next pass -//second pass applies the values - -//stages -// Determined Loudnorm Values -// Applying Normalisation -// Normalisation Complete - - -//setup global vars - -var secondPass = false; -var logOutFile = ''; - -var fs = require('fs'); - -const details = () => { - return { - id: "Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation", - Stage: 'Pre-processing', - Name: "2 Pass Loudnorm Volume Normalisation", - Type: "Video", - Operation: "Transcode", - Description: "PLEASE READ FULL DESCRIPTION BEFORE USE \n Uses multiple passes to normalise audio streams of videos using loudnorm.\n\n The first pass will create an log file in the same directory as the video.\nSecond pass will apply the values determined in the first pass to the file.\nOutput will be MKV to allow metadata to be added for tracking normalisation stage.", - Version: "0.1", - Tags: "pre-processing,ffmpeg,configurable", - - Inputs: [ - //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI - { - name: "i", - type: 'string', - defaultValue:'-23.0', - inputUI: { - type: 'text', - }, - tooltip: `\"I\" value used in loudnorm pass \n - defaults to -23.0`, //Each line following `Example:` will be clearly formatted. \\n used for line breaks - }, - { - name: "lra", - type: 'string', - defaultValue:'7.0', - inputUI: { - type: 'text', - }, - tooltip: `Desired lra value. \n Defaults to 7.0 - `, - }, - { - name: "tp", - type: 'string', - defaultValue:'-2.0', - inputUI: { - type: 'text', - }, - tooltip: `Desired \"tp\" value. \n Defaults to -2.0 - `, - }, - { - name: "offset", - type: 'string', - defaultValue:'0.0', - inputUI: { - type: 'text', - }, - tooltip: `Desired "offset" value. \n Defaults to 0.0 - `, - }, - ], - } -} - -// eslint-disable-next-line no-unused-vars -const plugin = (file, librarySettings, inputs, otherArguments) => { - // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); - - //Must return this object at some point - var response = { - processFile: false, - preset: '', - container: '.mkv', - handBrakeMode: false, - FFmpegMode: true, - reQueueAfter: true, - infoLog: '', - - } - - response.infoLog += "" - //grab the current file being processed and make an out file for the ffmpeg log - let currentfilename = file._id; - logOutFile = currentfilename.substr(0, currentfilename.lastIndexOf(".")) + ".out" - console.log("Log out file: " + logOutFile) - - //get an updated version of the file for checking metadata - var probeData = JSON.parse(require("child_process").execSync(`ffprobe -v quiet -print_format json -show_format -show_streams "${currentfilename}"`).toString()) - - //setup required varibles - var loudNorm_i = -23.0 - var lra = 7.0 - var tp = -2.0 - var offset = 0.0 - - //create local varibles for inputs - if (inputs !== undefined) { - if (inputs.i !== undefined) loudNorm_i = inputs.i - if (inputs.lra !== undefined) lra = inputs.lra - if (inputs.tp !== undefined) tp = inputs.tp - if (inputs.offset !== undefined) offset = inputs.offset - } - - - //check for previous pass tags - - if (typeof probeData.format === "undefined" || typeof probeData.format.tags.NORMALISATIONSTAGE === "undefined" || probeData.format.tags.NORMALISATIONSTAGE === "" || file.forceProcessing === true) { - - //no metadata found first pass is required - console.log("Searching for audio normailisation values") - response.infoLog += "Searching for required normalisation values. \n" - var loudNormInfo = ""; - - //Do the first pass, output the log to the out file and use a secondary output for an unchanged file to allow Tdarr to track, Set metadata stage - response.preset = `-af loudnorm=I=${loudNorm_i}:LRA=${lra}:TP=${tp}:print_format=json -f null NUL -map 0 -c copy -metadata NORMALISATIONSTAGE="FirstPassComplete" 2>"${logOutFile}"` - response.container = '.mkv' - response.handBrakeMode = false - response.FFmpegMode = true - response.reQueueAfter = true; - response.processFile = true - response.infoLog += "Normalisation first pass processing \n" - return response - } - if (probeData.format.tags.NORMALISATIONSTAGE === "FirstPassComplete") { - - //ensure previous out file exists - if (fs.existsSync(logOutFile)) { - secondPass = true; - loudNormInfo = fs.readFileSync(logOutFile).toString(); - - //grab the json from the out file - var startIndex = loudNormInfo.lastIndexOf("{"); - var endIndex = loudNormInfo.lastIndexOf("}"); - - var outValues = loudNormInfo.toString().substr(startIndex, endIndex) - - response.infoLog += "Loudnorm first pass values returned: \n" + outValues - - //parse the JSON - var loudNormValues = JSON.parse(outValues) - - //use parsed values in second pass - response.preset = `-y-af loudnorm=print_format=summary:linear=true:I=${loudNorm_i}:LRA=${lra}:TP=${tp}:measured_i=${loudNormValues.input_i}:measured_lra=${loudNormValues.input_lra}:measured_tp=${loudNormValues.input_tp}:measured_thresh=${loudNormValues.input_thresh}:offset=${loudNormValues.target_offset} -c:a aac -b:a 192k -c:s copy -c:v copy -metadata NORMALISATIONSTAGE="Complete"` - response.container = '.mkv' - response.handBrakeMode = false - response.FFmpegMode = true - response.reQueueAfter = true; - response.processFile = true - response.infoLog += "Normalisation pass processing \n" - return response - } else { - response.infoLog += "Previous log output file is missing. Please rerun with force processing to regenerate." - response.processFile = false; - return response - - } - } - if(probeData.format.tags.NORMALISATIONSTAGE === "Complete"){ - response.processFile = false; - response.infoLog += "File is already marked as normalised \n" - return response - } else { - //what is this tag? - response.processFile = false; - response.infoLog += "Unknown normalisation stage tag: \n" + probeData.format.tags.NORMALISATIONSTAGE - return response - } - - -} - -module.exports.onTranscodeSuccess = function onTranscodeSuccess( - file, - librarySettings, - inputs -) { - - var response = { - file, - removeFromDB: false, - updateDB: true, - }; - if (secondPass) { - response.infoLog += "Audio normalisation complete. \n" - //remove old out file - if (fs.existsSync(logOutFile)) { - fs.unlinkSync(logOutFile); - } - return response; - } - else { - response.infoLog += "Audio normalisation first pass complete. \n" - return response; - } -}; - -module.exports.onTranscodeError = function onTranscodeError( - file, - librarySettings, - inputs -) { - console.log("Failed to normalise audio"); - - //Optional response if you need to modify database - var response = { - file, - removeFromDB: false, - updateDB: false, - }; - - return response; -}; - - - - +/* eslint-disable */ +//PLugin runs multipass loudnorm filter +//first run gets the required details and stores for the next pass +//second pass applies the values + +//stages +// Determined Loudnorm Values +// Applying Normalisation +// Normalisation Complete + + +//setup global vars + +var secondPass = false; +var logOutFile = ''; + +var fs = require('fs'); + +const details = () => { + return { + id: "Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation", + Stage: 'Pre-processing', + Name: "2 Pass Loudnorm Volume Normalisation", + Type: "Video", + Operation: "Transcode", + Description: "PLEASE READ FULL DESCRIPTION BEFORE USE \n Uses multiple passes to normalise audio streams of videos using loudnorm.\n\n The first pass will create an log file in the same directory as the video.\nSecond pass will apply the values determined in the first pass to the file.\nOutput will be MKV to allow metadata to be added for tracking normalisation stage.", + Version: "0.1", + Tags: "pre-processing,ffmpeg,configurable", + + Inputs: [ + //(Optional) Inputs you'd like the user to enter to allow your plugin to be easily configurable from the UI + { + name: "i", + type: 'string', + defaultValue:'-23.0', + inputUI: { + type: 'text', + }, + tooltip: `\"I\" value used in loudnorm pass \n + defaults to -23.0`, //Each line following `Example:` will be clearly formatted. \\n used for line breaks + }, + { + name: "lra", + type: 'string', + defaultValue:'7.0', + inputUI: { + type: 'text', + }, + tooltip: `Desired lra value. \n Defaults to 7.0 + `, + }, + { + name: "tp", + type: 'string', + defaultValue:'-2.0', + inputUI: { + type: 'text', + }, + tooltip: `Desired \"tp\" value. \n Defaults to -2.0 + `, + }, + { + name: "offset", + type: 'string', + defaultValue:'0.0', + inputUI: { + type: 'text', + }, + tooltip: `Desired "offset" value. \n Defaults to 0.0 + `, + }, + ], + } +} + +// eslint-disable-next-line no-unused-vars +const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); + // eslint-disable-next-line no-unused-vars,no-param-reassign + inputs = lib.loadDefaultValues(inputs, details); + + //Must return this object at some point + var response = { + processFile: false, + preset: '', + container: '.mkv', + handBrakeMode: false, + FFmpegMode: true, + reQueueAfter: true, + infoLog: '', + + } + + response.infoLog += "" + //grab the current file being processed and make an out file for the ffmpeg log + let currentfilename = file._id; + logOutFile = currentfilename.substr(0, currentfilename.lastIndexOf(".")) + ".out" + console.log("Log out file: " + logOutFile) + + //get an updated version of the file for checking metadata + var probeData = JSON.parse(require("child_process").execSync(`ffprobe -v quiet -print_format json -show_format -show_streams "${currentfilename}"`).toString()) + + //setup required varibles + var loudNorm_i = -23.0 + var lra = 7.0 + var tp = -2.0 + var offset = 0.0 + + //create local varibles for inputs + if (inputs !== undefined) { + if (inputs.i !== undefined) loudNorm_i = inputs.i + if (inputs.lra !== undefined) lra = inputs.lra + if (inputs.tp !== undefined) tp = inputs.tp + if (inputs.offset !== undefined) offset = inputs.offset + } + + + //check for previous pass tags + + if (typeof probeData.format === "undefined" || typeof probeData.format.tags.NORMALISATIONSTAGE === "undefined" || probeData.format.tags.NORMALISATIONSTAGE === "" || file.forceProcessing === true) { + + //no metadata found first pass is required + console.log("Searching for audio normailisation values") + response.infoLog += "Searching for required normalisation values. \n" + var loudNormInfo = ""; + + //Do the first pass, output the log to the out file and use a secondary output for an unchanged file to allow Tdarr to track, Set metadata stage + response.preset = `-af loudnorm=I=${loudNorm_i}:LRA=${lra}:TP=${tp}:print_format=json -f null NUL -map 0 -c copy -metadata NORMALISATIONSTAGE="FirstPassComplete" 2>"${logOutFile}"` + response.container = '.mkv' + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.processFile = true + response.infoLog += "Normalisation first pass processing \n" + return response + } + if (probeData.format.tags.NORMALISATIONSTAGE === "FirstPassComplete") { + + //ensure previous out file exists + if (fs.existsSync(logOutFile)) { + secondPass = true; + loudNormInfo = fs.readFileSync(logOutFile).toString(); + + //grab the json from the out file + var startIndex = loudNormInfo.lastIndexOf("{"); + var endIndex = loudNormInfo.lastIndexOf("}"); + + var outValues = loudNormInfo.toString().substr(startIndex, endIndex) + + response.infoLog += "Loudnorm first pass values returned: \n" + outValues + + //parse the JSON + var loudNormValues = JSON.parse(outValues) + + //use parsed values in second pass + response.preset = `-y-af loudnorm=print_format=summary:linear=true:I=${loudNorm_i}:LRA=${lra}:TP=${tp}:measured_i=${loudNormValues.input_i}:measured_lra=${loudNormValues.input_lra}:measured_tp=${loudNormValues.input_tp}:measured_thresh=${loudNormValues.input_thresh}:offset=${loudNormValues.target_offset} -c:a aac -b:a 192k -c:s copy -c:v copy -metadata NORMALISATIONSTAGE="Complete"` + response.container = '.mkv' + response.handBrakeMode = false + response.FFmpegMode = true + response.reQueueAfter = true; + response.processFile = true + response.infoLog += "Normalisation pass processing \n" + return response + } else { + response.infoLog += "Previous log output file is missing. Please rerun with force processing to regenerate." + response.processFile = false; + return response + + } + } + if(probeData.format.tags.NORMALISATIONSTAGE === "Complete"){ + response.processFile = false; + response.infoLog += "File is already marked as normalised \n" + return response + } else { + //what is this tag? + response.processFile = false; + response.infoLog += "Unknown normalisation stage tag: \n" + probeData.format.tags.NORMALISATIONSTAGE + return response + } + + +} + +module.exports.onTranscodeSuccess = function onTranscodeSuccess( + file, + librarySettings, + inputs +) { + + var response = { + file, + removeFromDB: false, + updateDB: true, + }; + if (secondPass) { + response.infoLog += "Audio normalisation complete. \n" + //remove old out file + if (fs.existsSync(logOutFile)) { + fs.unlinkSync(logOutFile); + } + return response; + } + else { + response.infoLog += "Audio normalisation first pass complete. \n" + return response; + } +}; + +module.exports.onTranscodeError = function onTranscodeError( + file, + librarySettings, + inputs +) { + console.log("Failed to normalise audio"); + + //Optional response if you need to modify database + var response = { + file, + removeFromDB: false, + updateDB: false, + }; + + return response; +}; + + + + module.exports.details = details; module.exports.plugin = plugin; \ No newline at end of file diff --git a/Community/Tdarr_Plugin_O8O0dCTlb_Set_File_Permissions_For_UnRaid.js b/Community/Tdarr_Plugin_O8O0dCTlb_Set_File_Permissions_For_UnRaid.js index a69cb2a..995ca6b 100644 --- a/Community/Tdarr_Plugin_O8O0dCTlb_Set_File_Permissions_For_UnRaid.js +++ b/Community/Tdarr_Plugin_O8O0dCTlb_Set_File_Permissions_For_UnRaid.js @@ -1,5 +1,5 @@ /* eslint-disable */ -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { @@ -17,8 +17,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object at some point var response = { diff --git a/Community/Tdarr_Plugin_SV6x_Smoove1FFMPEG_NVENC_H264.js b/Community/Tdarr_Plugin_SV6x_Smoove1FFMPEG_NVENC_H264.js index eca248b..a18c03e 100644 --- a/Community/Tdarr_Plugin_SV6x_Smoove1FFMPEG_NVENC_H264.js +++ b/Community/Tdarr_Plugin_SV6x_Smoove1FFMPEG_NVENC_H264.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ // This is almost a line for line copy of Migz1FFMPEG // https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -58,8 +57,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, infoLog: '', diff --git a/Community/Tdarr_Plugin_TD01_TOAD_Autoscan.js b/Community/Tdarr_Plugin_TD01_TOAD_Autoscan.js index 667ce29..46eda07 100644 --- a/Community/Tdarr_Plugin_TD01_TOAD_Autoscan.js +++ b/Community/Tdarr_Plugin_TD01_TOAD_Autoscan.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable linebreak-style */ module.exports.dependencies = [ 'request', @@ -77,8 +76,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // eslint-disable-next-line global-require,import/no-unresolved,import/no-extraneous-dependencies const request = require('request'); // Set up required variables. diff --git a/Community/Tdarr_Plugin_VP92_VP9_Match_Bitrate_One_Pass.js b/Community/Tdarr_Plugin_VP92_VP9_Match_Bitrate_One_Pass.js index 97dbf74..83c93e3 100644 --- a/Community/Tdarr_Plugin_VP92_VP9_Match_Bitrate_One_Pass.js +++ b/Community/Tdarr_Plugin_VP92_VP9_Match_Bitrate_One_Pass.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint max-classes-per-file: ["error", 2] */ const details = () => ({ id: 'Tdarr_Plugin_VP92_VP9_Match_Bitrate_One_Pass', @@ -23,7 +22,7 @@ const details = () => ({ 'The CQ number (recommended 15-35) for this resolution, default 32', }, { - name: 'CG_360p', + name: 'CQ_360p', type: 'string', defaultValue: '31', inputUI: { @@ -502,8 +501,10 @@ function buildSubtitleConfiguration(inputs, file, logger) { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { container: '.webm', diff --git a/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js b/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js index e8b958c..508c8a8 100644 --- a/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_a37x_Drawmonster_MP4_No_Title_Meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js index 55499e1..c83b44e 100644 --- a/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js +++ b/Community/Tdarr_Plugin_a8hc_HaveAGitGat_HandBrake_H264_VeryFast1080p30.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -18,8 +17,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object diff --git a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js index 36e291b..dc9eb82 100644 --- a/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js +++ b/Community/Tdarr_Plugin_a9hc_HaveAGitGat_HandBrake_H264_Fast1080p30.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -18,8 +17,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js index 71ada74..90e3b70 100644 --- a/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js +++ b/Community/Tdarr_Plugin_a9hd_FFMPEG_Transcode_Specific_Audio_Stream_Codecs.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -67,8 +66,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_a9he_New_file_size_check.js b/Community/Tdarr_Plugin_a9he_New_file_size_check.js index 9861a0e..10528be 100644 --- a/Community/Tdarr_Plugin_a9he_New_file_size_check.js +++ b/Community/Tdarr_Plugin_a9he_New_file_size_check.js @@ -1,6 +1,3 @@ -// eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_a9he_New_file_size_check', Stage: 'Pre-processing', @@ -37,8 +34,10 @@ const details = () => ({ }); const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object at some point in the function else plugin will fail. const response = { processFile: false, diff --git a/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js b/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js index 4cd8f84..df0f90f 100644 --- a/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js +++ b/Community/Tdarr_Plugin_a9hf_New_file_duration_check.js @@ -1,5 +1,4 @@ // eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); const details = () => ({ id: 'Tdarr_Plugin_a9hf_New_file_duration_check', @@ -38,8 +37,10 @@ const details = () => ({ }); const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object at some point in the function else plugin will fail. const response = { processFile: false, diff --git a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js index 6c02f2b..fbb6671 100644 --- a/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js +++ b/Community/Tdarr_Plugin_b38x_Nosirus_h265_aac_no_meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js index 3a459b1..efcd2bf 100644 --- a/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js +++ b/Community/Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_b39x_the1poet_surround_sound_to_ac3', Stage: 'Pre-processing', @@ -31,8 +29,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_c0r1_SetDefaultAudioStream.js b/Community/Tdarr_Plugin_c0r1_SetDefaultAudioStream.js index 70cdd87..99e4dcc 100644 --- a/Community/Tdarr_Plugin_c0r1_SetDefaultAudioStream.js +++ b/Community/Tdarr_Plugin_c0r1_SetDefaultAudioStream.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -39,8 +38,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { processFile: false, preset: "", diff --git a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js index a1e6ec0..76cda8f 100644 --- a/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js +++ b/Community/Tdarr_Plugin_d5d3_iiDrakeii_FFMPEG_NVENC_Tiered_MKV.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var transcode = 0; //if this var changes to 1 the file will be transcoded var bitrateprobe = 0; //bitrate from ffprobe var bitratetarget = 0; diff --git a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js index f882c82..5502157 100644 --- a/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js +++ b/Community/Tdarr_Plugin_d5d4_iiDrakeii_Not_A_Video_Mjpeg_Fix.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var transcode = 0; //if this var changes to 1 the file will be transcoded //default values that will be returned var response = { diff --git a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js index a8b8e5f..8910917 100644 --- a/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js +++ b/Community/Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -59,8 +58,10 @@ const BAD = false; // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { processFile: false, preset: "", diff --git a/Community/Tdarr_Plugin_drdd_standardise_all_in_one.js b/Community/Tdarr_Plugin_drdd_standardise_all_in_one.js index 1e0b48e..3a90f0b 100644 --- a/Community/Tdarr_Plugin_drdd_standardise_all_in_one.js +++ b/Community/Tdarr_Plugin_drdd_standardise_all_in_one.js @@ -1,5 +1,5 @@ /* eslint-disable */ -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { id: "Tdarr_Plugin_drdd_standardise_all_in_one", @@ -409,8 +409,10 @@ function buildVideoConfiguration(inputs, file, logger) { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var response = { container: ".mkv", FFmpegMode: true, diff --git a/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js index 4407877..56d0dd3 100644 --- a/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3jc_Tharic_H.264_MKV_480p30_No_Subs_No_Title_Meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js index eb20bd9..33799c7 100644 --- a/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3jd_Tharic_H.264_MKV_720p30_No_Subs_No_Title_Meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js b/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js index adf701e..f4ed6b3 100644 --- a/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_e3je_Tharic_H.264_MKV_1080p30_No_Subs_No_Title_Meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js index f14aadd..018da4b 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Add_Subtitles.js @@ -1,7 +1,7 @@ /* eslint-disable */ const fs = require("fs"); const execSync = require("child_process").execSync; -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { @@ -38,8 +38,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //default response var response = { processFile: false, diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js index 4f3c119..ad4f384 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Keep_Preferred_Audio.js @@ -1,7 +1,7 @@ /* eslint-disable */ const exec = require("child_process").exec; const fs = require("fs"); -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { @@ -48,8 +48,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); if (inputs.languages == "" || typeof inputs.special == "undefined") { var languages = ["eng", "en"]; //these languages should be kept, named according to ISO 639-2 language scheme } else { diff --git a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js index f03b292..7f0e15d 100644 --- a/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js +++ b/Community/Tdarr_Plugin_e5c3_CnT_Remove_Letterbox.js @@ -1,7 +1,7 @@ /* eslint-disable */ const fs = require("fs"); const execSync = require("child_process").execSync; -const loadDefaultValues = require('../methods/loadDefaultValues'); + const details = () => { return { @@ -38,8 +38,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); if (inputs.bitrate == "" || inputs.bitrate == "undefined") { var min_bitrate = 6600; var avg_rate = 3000; diff --git a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js index f97af11..b27121d 100644 --- a/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js +++ b/Community/Tdarr_Plugin_fd5T_Sparticus_4K_AC3_No_Subs.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_henk_Add_Specific_Audio_Codec.js b/Community/Tdarr_Plugin_henk_Add_Specific_Audio_Codec.js index 5a1579e..4211865 100644 --- a/Community/Tdarr_Plugin_henk_Add_Specific_Audio_Codec.js +++ b/Community/Tdarr_Plugin_henk_Add_Specific_Audio_Codec.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_henk_Add_Specific_Audio_Codec', Stage: 'Pre-processing', @@ -70,8 +68,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: ', -c copy -map 0:v ', diff --git a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js index 0d601ea..3260e66 100644 --- a/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js +++ b/Community/Tdarr_Plugin_henk_Keep_Native_Lang_Plus_Eng.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable no-await-in-loop */ module.exports.dependencies = ['axios', '@cospired/i18n-iso-languages', 'path']; const details = () => ({ @@ -224,8 +223,10 @@ const parseArrResponse = async (body, filePath, arr) => { // eslint-disable-next-line no-unused-vars const plugin = async (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // eslint-disable-next-line global-require,import/no-unresolved const axios = require('axios').default; response.container = `.${file.container}`; diff --git a/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js b/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js index fb63539..8b4afea 100644 --- a/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js +++ b/Community/Tdarr_Plugin_hk75_Drawmonster_MP4_AAC_No_Subs_No_metaTitle.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js b/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js index 5b30d14..3aa747f 100644 --- a/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js +++ b/Community/Tdarr_Plugin_hk76_GilbN_MP4_AAC_No_metaTitle.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC.js b/Community/Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC.js index 338385b..5dadb17 100644 --- a/Community/Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC.js +++ b/Community/Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_jeons001_Downmix_to_stereo_and_apply_DRC', Stage: 'Pre-processing', @@ -15,8 +13,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, preset: '', diff --git a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js index aead90a..a83aebc 100644 --- a/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js +++ b/Community/Tdarr_Plugin_lmg1_Reorder_Streams.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js index 16292fc..2f5f462 100644 --- a/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js +++ b/Community/Tdarr_Plugin_nc7x_Drawmonster_No_Title_Meta.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js index cd7d5f8..88629c6 100644 --- a/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js +++ b/Community/Tdarr_Plugin_r002_rootuser_FFMPEG_HQ_HEVC_MKV_Animation.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var transcode = 0; //if this var changes to 1 the file will be transcoded //default values that will be returned diff --git a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js index 692bc55..0605af3 100644 --- a/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js +++ b/Community/Tdarr_Plugin_raf4_Floorpie_FFmpeg_Tiered_HEVC_MKV.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var transcode = 0; //if this var changes to 1 the file will be transcoded //default values that will be returned diff --git a/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js b/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js index 962ca2e..305e15f 100644 --- a/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js +++ b/Community/Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js @@ -1,5 +1,4 @@ const fs = require('fs'); -const loadDefaultValues = require('../methods/loadDefaultValues'); const details = () => ({ id: 'Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT', @@ -39,8 +38,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object at some point in the function else plugin will fail. const response = { processFile: true, diff --git a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js index b6c0236..a95ef5f 100644 --- a/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js +++ b/Community/Tdarr_Plugin_s710_nick_h265_nvenc_4K.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_s7x8_winsome_h265.js b/Community/Tdarr_Plugin_s7x8_winsome_h265.js index 52f540c..c8c9e43 100644 --- a/Community/Tdarr_Plugin_s7x8_winsome_h265.js +++ b/Community/Tdarr_Plugin_s7x8_winsome_h265.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js index 7cb86b5..d9320bb 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_10bit.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js index f2b2673..7c7c856 100644 --- a/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js +++ b/Community/Tdarr_Plugin_s7x9_winsome_h265_nvenc.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js index 734887a..d7a0a92 100644 --- a/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js +++ b/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js b/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js index ec09b75..cad0211 100644 --- a/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js +++ b/Community/Tdarr_Plugin_sdf5_Thierrrrry_Remove_Non_English_Audio.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_vdka_Remove_DataStreams.js b/Community/Tdarr_Plugin_vdka_Remove_DataStreams.js index 9257d77..d1e3227 100644 --- a/Community/Tdarr_Plugin_vdka_Remove_DataStreams.js +++ b/Community/Tdarr_Plugin_vdka_Remove_DataStreams.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_vdka_Tiered_CPU_CRF_Based_Configurable.js b/Community/Tdarr_Plugin_vdka_Tiered_CPU_CRF_Based_Configurable.js index cc61640..46d2466 100644 --- a/Community/Tdarr_Plugin_vdka_Tiered_CPU_CRF_Based_Configurable.js +++ b/Community/Tdarr_Plugin_vdka_Tiered_CPU_CRF_Based_Configurable.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_vdka_Tiered_CPU_CRF_Based_Configurable', Stage: 'Pre-processing', @@ -18,7 +16,7 @@ const details = () => ({ { name: 'sdCRF', type: 'string', - defaultValue: '19', + defaultValue: '20', inputUI: { type: 'text', }, @@ -31,7 +29,7 @@ const details = () => ({ { name: 'hdCRF', type: 'string', - defaultValue: '21', + defaultValue: '22', inputUI: { type: 'text', }, @@ -44,7 +42,7 @@ const details = () => ({ { name: 'fullhdCRF', type: 'string', - defaultValue: '23', + defaultValue: '24', inputUI: { type: 'text', }, @@ -57,7 +55,7 @@ const details = () => ({ { name: 'uhdCRF', type: 'string', - defaultValue: '26', + defaultValue: '28', inputUI: { type: 'text', }, @@ -129,8 +127,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); let crf; // default values that will be returned const response = { diff --git a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js index 4c602e8..caba0b9 100644 --- a/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js +++ b/Community/Tdarr_Plugin_vdka_Tiered_NVENC_CQV_BASED_CONFIGURABLE.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -106,8 +105,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); var transcode = 0 //if this var changes to 1 the file will be transcoded var subcli = `-c:s copy` var maxmux = '' diff --git a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js index f1140fe..843c1eb 100644 --- a/Community/Tdarr_Plugin_x7ab_Remove_Subs.js +++ b/Community/Tdarr_Plugin_x7ab_Remove_Subs.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { return { @@ -16,8 +15,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); //Must return this object var response = { diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index e41d402..8d59eab 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_x7ac_Remove_Closed_Captions', Stage: 'Pre-processing', @@ -15,8 +13,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: false, // eslint-disable-next-line no-useless-escape diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index cf42af9..6152a4e 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium', Stage: 'Pre-processing', @@ -17,8 +15,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js index 17a7d21..4e7761a 100644 --- a/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js +++ b/Community/Tdarr_Plugin_z18s_rename_files_based_on_codec.js @@ -1,4 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); /* eslint-disable */ const details = () => { @@ -17,8 +16,10 @@ const details = () => { // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); try { var fs = require("fs"); var fileNameOld = file._id; diff --git a/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js b/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js index 8e2c35d..c91df56 100644 --- a/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js +++ b/Community/Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_z18t_rename_files_based_on_codec_and_resolution', Stage: 'Post-processing', @@ -14,8 +12,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); try { // eslint-disable-next-line global-require const fs = require('fs'); diff --git a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index 14fbc8b..027e40e 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast', Stage: 'Pre-processing', @@ -17,8 +15,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 25dfb1a..5ab700d 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow', Stage: 'Pre-processing', @@ -17,8 +15,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index fd8657c..6e37965 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast', Stage: 'Pre-processing', @@ -19,8 +17,10 @@ const details = () => ({ // eslint-disable-next-line // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object const response = { diff --git a/Community/Tdarr_Plugin_z80t_keep_original_date.js b/Community/Tdarr_Plugin_z80t_keep_original_date.js index 030dd8e..03eca8b 100644 --- a/Community/Tdarr_Plugin_z80t_keep_original_date.js +++ b/Community/Tdarr_Plugin_z80t_keep_original_date.js @@ -1,5 +1,3 @@ -const loadDefaultValues = require('../methods/loadDefaultValues'); - module.exports.dependencies = [ 'axios', 'path-extra', @@ -66,8 +64,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = async (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // eslint-disable-next-line global-require,import/no-unresolved const axios = require('axios'); // eslint-disable-next-line global-require,import/no-unresolved diff --git a/examples/Tdarr_Plugin_a9he_New_file_size_check.js b/examples/Tdarr_Plugin_a9he_New_file_size_check.js index bf672a0..e7da3a6 100644 --- a/examples/Tdarr_Plugin_a9he_New_file_size_check.js +++ b/examples/Tdarr_Plugin_a9he_New_file_size_check.js @@ -1,6 +1,3 @@ -// eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_a9he_New_file_size_check', Stage: 'Pre-processing', @@ -14,8 +11,10 @@ const details = () => ({ }); const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object at some point in the function else plugin will fail. const response = { processFile: false, diff --git a/examples/Tdarr_Plugin_f001_Filter_Example.js b/examples/Tdarr_Plugin_f001_Filter_Example.js index c2d5a56..cfcbd30 100644 --- a/examples/Tdarr_Plugin_f001_Filter_Example.js +++ b/examples/Tdarr_Plugin_f001_Filter_Example.js @@ -1,6 +1,3 @@ -// eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_f001_Filter_Example', Stage: 'Pre-processing', @@ -15,8 +12,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Must return this object at some point in the function else plugin will fail. const response = { diff --git a/examples/Tdarr_Plugin_f002_Filter_Example.js b/examples/Tdarr_Plugin_f002_Filter_Example.js index b29d518..926ec9f 100644 --- a/examples/Tdarr_Plugin_f002_Filter_Example.js +++ b/examples/Tdarr_Plugin_f002_Filter_Example.js @@ -1,6 +1,3 @@ -// eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); - const details = () => ({ id: 'Tdarr_Plugin_f002_Filter_Example', Stage: 'Pre-processing', @@ -15,8 +12,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); const response = { processFile: true, infoLog: '', diff --git a/examples/Tdarr_Plugin_pos1_Post_Proc_Example.js b/examples/Tdarr_Plugin_pos1_Post_Proc_Example.js index 343e3cd..1a5d1fd 100644 --- a/examples/Tdarr_Plugin_pos1_Post_Proc_Example.js +++ b/examples/Tdarr_Plugin_pos1_Post_Proc_Example.js @@ -5,9 +5,6 @@ /* eslint import/no-extraneous-dependencies: 0 */ // --> OFF /* eslint no-console: 0 */ // --> OFF -// eslint-disable-next-line import/no-unresolved -const loadDefaultValues = require('../methods/loadDefaultValues'); - // List any npm dependencies which the plugin needs, they will be auto installed when the plugin runs: module.exports.dependencies = [ 'import-fresh', @@ -43,25 +40,15 @@ const details = () => ({ \\nExample:\\n de`, // Each line following `Example:` will be clearly formatted. \\n used for line breaks }, - { - name: 'channels', - type: 'string', - defaultValue: 'eng', - inputUI: { - type: 'text', - }, - tooltip: `Desired audio channel number. - - \\nExample:\\n - 2`, - }, ], }); // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Only 'require' dependencies within this function or other functions. Do not require in the top scope. const importFresh = require('import-fresh'); diff --git a/examples/Tdarr_Plugin_pre1_Pre_Proc_Example.js b/examples/Tdarr_Plugin_pre1_Pre_Proc_Example.js index 30c0d8f..0651610 100644 --- a/examples/Tdarr_Plugin_pre1_Pre_Proc_Example.js +++ b/examples/Tdarr_Plugin_pre1_Pre_Proc_Example.js @@ -5,7 +5,6 @@ /* eslint import/no-extraneous-dependencies: 0 */ // --> OFF /* eslint no-console: 0 */ // --> OFF -const loadDefaultValues = require('../methods/loadDefaultValues'); // List any npm dependencies which the plugin needs, they will be auto installed when the plugin runs: module.exports.dependencies = [ 'import-fresh', @@ -71,8 +70,10 @@ const details = () => ({ // eslint-disable-next-line no-unused-vars const plugin = (file, librarySettings, inputs, otherArguments) => { + // eslint-disable-next-line global-require + const lib = require('../methods/lib')(); // eslint-disable-next-line no-unused-vars,no-param-reassign - inputs = loadDefaultValues(inputs, details); + inputs = lib.loadDefaultValues(inputs, details); // Only 'require' dependencies within this function or other functions. Do not require in the top scope. const importFresh = require('import-fresh'); diff --git a/tests/checkPlugins.js b/tests/checkPlugins.js index e7171dd..2070150 100644 --- a/tests/checkPlugins.js +++ b/tests/checkPlugins.js @@ -26,10 +26,10 @@ folders.forEach((folder) => { for (let i = 0; i < files.length; i += 1) { let read = fs.readFileSync(`${folder}/${files[i]}`).toString(); - const importDefaultValues = 'const loadDefaultValues = require(\'../methods/loadDefaultValues\');'; - if (!read.includes(importDefaultValues)) { - console.log(`Plugin error: '${folder}/${files[i]}' does not contain ${importDefaultValues}`); - read = `${importDefaultValues}\n${read}`; + const importLib = 'const lib = require(\'../methods/lib\')();'; + if (!read.includes(importLib)) { + console.log(`Plugin error: '${folder}/${files[i]}' does not contain ${importLib}`); + read = `${importLib}\n${read}`; // fs.writeFileSync(`${folder}/${files[i]}`, read) process.exit(1); } @@ -50,7 +50,7 @@ folders.forEach((folder) => { process.exit(1); } - const inputsText = 'inputs = loadDefaultValues(inputs, details);'; + const inputsText = 'inputs = lib.loadDefaultValues(inputs, details);'; if (!read.includes(inputsText) ) { console.log(`Plugin error: '${folder}/${files[i]}' does not contain ${inputsText}`); @@ -157,10 +157,19 @@ module.exports.plugin = plugin;`; console.log(`Plugin Input type does not match defaultValue type: '${folder}/${files[i]}' : ${inputs[j].name}`); process.exit(1); + } else if (!['text', 'dropdown'].includes(inputs[j].inputUI.type)) { + console.log(`Plugin Input inputUI is invalid: '${folder}/${files[i]}' : ${inputs[j].name}`); + process.exit(1); } else if (inputs[j].defaultValue === undefined) { console.log(`Plugin Input does not have a default value: '${folder}/${files[i]}' : ${inputs[j].name}`); process.exit(1); } + + const count = read.split(inputs[j].name).length - 1; + if (count === 1) { + console.log(`Plugin Input is not used: '${folder}/${files[i]}' : ${inputs[j].name}`); + process.exit(1); + } } }