Update: All Migz Plugins

1) Ran all plugins through javascript formatter to make them look nicer/ have correct javascript formatting.

2) Added comments to all plugins.

3) Modified all plugins that have checks for inputs to check for existance of inputs itself.

4) Modify 5ConvertAudio so that you can just put "true" in a single input, rather then having to put false in the opposing one. If only 1 action is wanted.

5) Fix for 3CleanAudio & 4CleanSubs where if language meta was completely missing then plugins would not set it to the specified tag language.

6) Correct 4CleanSubs input title of "tag_title" to "tag_language"
This commit is contained in:
Migz93 2020-04-19 20:31:35 +01:00
parent 3e4b2c7126
commit 20fe6461a1
9 changed files with 998 additions and 883 deletions

View file

@ -1,60 +1,64 @@
function details() {
return {
id: "Tdarr_Plugin_MC93_MigzImageRemoval",
Stage: "Pre-processing",
Name: "Migz-Remove image formats from file",
Type: "Video",
Operation:"Clean",
Description: `Identify any unwanted image formats in the file and remove those streams. MJPEG & PNG \n\n`,
Version: "1.0",
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js",
Tags:'pre-processing,ffmpeg,video only'
}
return {
id: "Tdarr_Plugin_MC93_MigzImageRemoval",
Stage: "Pre-processing",
Name: "Migz-Remove image formats from file",
Type: "Video",
Operation: "Clean",
Description: `Identify any unwanted image formats in the file and remove those streams. MJPEG & PNG \n\n`,
Version: "1.1",
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_MigzImageRemoval.js",
Tags: 'pre-processing,ffmpeg,video only'
}
}
function plugin(file, librarySettings, inputs) {
var response = {
processFile: false,
preset: '',
handBrakeMode: false,
container: '.' + file.container,
FFmpegMode: true,
reQueueAfter: true,
infoLog: ''
}
if (file.fileMedium !== "video") {
response.processFile = false
response.infoLog += "☒File is not a video. \n"
return response
var response = {
processFile: false,
preset: '',
handBrakeMode: false,
container: '.' + file.container,
FFmpegMode: true,
reQueueAfter: true,
infoLog: ''
}
var videoIdx = 0
var extraArguments = ""
var convert = false
// Check if file is a video. If it isn't then exit plugin.
if (file.fileMedium !== "video") {
response.processFile = false
response.infoLog += "☒File is not a video. \n"
return response
}
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
if (file.ffProbeData.streams[i].codec_name == 'mjpeg' || file.ffProbeData.streams[i].codec_name == 'png') {
convert = true
extraArguments += `-map -v:${videoIdx} `
}
videoIdx++
}
}
// Set up required variables.
var videoIdx = 0
var extraArguments = ""
var convert = false
if (convert === true ) {
response.preset += `,-map 0 -c copy -max_muxing_queue_size 4096 ${extraArguments}`
response.infoLog += `☒File has image format stream, removing. \n`
response.processFile = true;
// Go through each stream in the file.
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
// Check if stream is video.
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
// Check if stream codec is mjpeg or png. Remove if so.
if (file.ffProbeData.streams[i].codec_name == 'mjpeg' || file.ffProbeData.streams[i].codec_name == 'png') {
convert = true
extraArguments += `-map -v:${videoIdx} `
}
// Increment videoIdx.
videoIdx++
}
}
// Convert file if convert variable is set to true.
if (convert === true) {
response.preset += `,-map 0 -c copy -max_muxing_queue_size 4096 ${extraArguments}`
response.infoLog += `☒File has image format stream, removing. \n`
response.processFile = true;
} else {
response.processFile = false;
response.infoLog += "☑File doesn't contain any unwanted image format streams.\n"
response.processFile = false;
response.infoLog += "☑File doesn't contain any unwanted image format streams.\n"
}
return response
return response
}
module.exports.details = details;
module.exports.plugin = plugin;
module.exports.plugin = plugin;