mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-16 18:45:53 -07:00
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:
parent
3e4b2c7126
commit
20fe6461a1
9 changed files with 998 additions and 883 deletions
|
|
@ -1,106 +1,116 @@
|
|||
function details() {
|
||||
return {
|
||||
id: "Tdarr_Plugin_MC93_Migz2CleanTitle",
|
||||
Stage: "Pre-processing",
|
||||
Name: "Migz-Clean title metadata",
|
||||
Type: "Video",
|
||||
Operation: "Clean",
|
||||
Description: `This plugin removes title metadata from video/audio/subtitles, if it exists. Video checking is mandatory, audio and subtitles are optional.\n\n`,
|
||||
Version: "1.20",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js",
|
||||
Tags:'pre-processing,ffmpeg,configurable',
|
||||
Inputs: [
|
||||
{
|
||||
name: 'clean_audio',
|
||||
tooltip: `Specify if audio titles should be checked & cleaned. Optional.
|
||||
\\nExample:\\n
|
||||
true
|
||||
return {
|
||||
id: "Tdarr_Plugin_MC93_Migz2CleanTitle",
|
||||
Stage: "Pre-processing",
|
||||
Name: "Migz-Clean title metadata",
|
||||
Type: "Video",
|
||||
Operation: "Clean",
|
||||
Description: `This plugin removes title metadata from video/audio/subtitles, if it exists. Video checking is mandatory, audio and subtitles are optional.\n\n`,
|
||||
Version: "1.2",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js",
|
||||
Tags: 'pre-processing,ffmpeg,configurable',
|
||||
Inputs: [{
|
||||
name: 'clean_audio',
|
||||
tooltip: `Specify if audio titles should be checked & cleaned. Optional.
|
||||
\\nExample:\\n
|
||||
true
|
||||
|
||||
\\nExample:\\n
|
||||
false`
|
||||
},
|
||||
{
|
||||
name: 'clean_subtitles',
|
||||
tooltip: `Specify if subtitle titles should be checked & cleaned. Optional.
|
||||
\\nExample:\\n
|
||||
true
|
||||
\\nExample:\\n
|
||||
false`
|
||||
},
|
||||
{
|
||||
name: 'clean_subtitles',
|
||||
tooltip: `Specify if subtitle titles should be checked & cleaned. Optional.
|
||||
\\nExample:\\n
|
||||
true
|
||||
|
||||
\\nExample:\\n
|
||||
false`
|
||||
},
|
||||
]
|
||||
}
|
||||
\\nExample:\\n
|
||||
false`
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
function plugin(file, librarySettings, inputs) {
|
||||
var response = {
|
||||
processFile : false,
|
||||
preset : '',
|
||||
container: '.' + file.container,
|
||||
handBrakeMode : false,
|
||||
FFmpegMode : true,
|
||||
reQueueAfter : false,
|
||||
infoLog : '',
|
||||
var response = {
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.' + file.container,
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var ffmpegCommandInsert = ''
|
||||
var videoIdx = 0
|
||||
var audioIdx = 0
|
||||
var subtitleIdx = 0
|
||||
var convert = false
|
||||
// Set up required variables.
|
||||
var ffmpegCommandInsert = ''
|
||||
var videoIdx = 0
|
||||
var audioIdx = 0
|
||||
var subtitleIdx = 0
|
||||
var convert = false
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
console.log("File is not video")
|
||||
response.infoLog += "☒File is not video \n"
|
||||
response.processFile = false;
|
||||
return response
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
// Check if overall file metadata title is not empty, if it's not empty set to "".
|
||||
if (typeof file.meta.Title != 'undefined') try {
|
||||
ffmpegCommandInsert += ` -metadata title="" `
|
||||
convert = true
|
||||
} catch (err) { }
|
||||
ffmpegCommandInsert += ` -metadata title="" `
|
||||
convert = true
|
||||
} catch (err) {}
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) try {
|
||||
// Go through each stream in the file.
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) try {
|
||||
// Check if stream is a video.
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") {
|
||||
if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') {
|
||||
response.infoLog += `☒Video stream title is not empty, most likely junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `
|
||||
convert = true
|
||||
// Check if stream title is not empty, if it's nto empty set to "".
|
||||
if (typeof file.ffProbeData.streams[i].tags.title != 'undefined') {
|
||||
response.infoLog += `☒Video stream title is not empty, most likely junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `
|
||||
convert = true
|
||||
}
|
||||
videoIdx++
|
||||
}
|
||||
// Increment videoIdx.
|
||||
videoIdx++
|
||||
}
|
||||
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && inputs.clean_audio.toLowerCase() == "true") {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) {
|
||||
response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" `
|
||||
convert = true
|
||||
}
|
||||
audioIdx++
|
||||
}
|
||||
// Check if title metadata of audio stream has more then 3 full stops. If so then it's likely to be junk metadata so remove.
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && inputs.clean_audio.toLowerCase() == "true") {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) {
|
||||
response.infoLog += `☒More then 3 full stops detected in audio title, likely to be junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" `
|
||||
convert = true
|
||||
}
|
||||
// Increment audioIdx.
|
||||
audioIdx++
|
||||
}
|
||||
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && inputs.clean_subtitles.toLowerCase() == "true") {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length-1 > 3) {
|
||||
response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" `
|
||||
convert = true
|
||||
}
|
||||
subtitleIdx++
|
||||
}
|
||||
} catch (err) { }
|
||||
// Check if title metadata of subtitle stream has more then 3 full stops. If so then it's likely to be junk metadata so remove.
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && inputs.clean_subtitles.toLowerCase() == "true") {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) {
|
||||
response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n`
|
||||
ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" `
|
||||
convert = true
|
||||
}
|
||||
// Increment subtitleIdx.
|
||||
subtitleIdx++
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
if (convert == true) {
|
||||
response.infoLog += "☒File has title metadata. Removing \n"
|
||||
response.preset = `,${ffmpegCommandInsert} -c copy -map 0 -max_muxing_queue_size 4096`
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
// Convert file if convert variable is set to true.
|
||||
if (convert == true) {
|
||||
response.infoLog += "☒File has title metadata. Removing \n"
|
||||
response.preset = `,${ffmpegCommandInsert} -c copy -map 0 -max_muxing_queue_size 4096`
|
||||
response.reQueueAfter = true;
|
||||
response.processFile = true;
|
||||
} else {
|
||||
response.infoLog += "☑File has no title metadata \n"
|
||||
response.infoLog += "☑File has no title metadata \n"
|
||||
}
|
||||
return response
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
module.exports.plugin = plugin;
|
||||
module.exports.plugin = plugin;
|
||||
Loading…
Add table
Add a link
Reference in a new issue