Merge pull request #105 from Migz93/master

Migz Plugin Updates
make-only-subtitle-default
HaveAGitGat 5 years ago committed by GitHub
commit 2d2dd3ec83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,7 +6,7 @@ function details() {
Type: "Video", Type: "Video",
Operation: "Transcode", Operation: "Transcode",
Description: `Files not in H265 will be transcoded into H265 using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`, Description: `Files not in H265 will be transcoded into H265 using Nvidia GPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. NVDEC & NVENC compatable GPU required. \n\n`,
Version: "2.6", Version: "2.7",
Link: Link:
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js", "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js",
Tags: "pre-processing,ffmpeg,video only,nvenc h265,configurable", Tags: "pre-processing,ffmpeg,video only,nvenc h265,configurable",
@ -132,34 +132,36 @@ function plugin(file, librarySettings, inputs) {
if (inputs.force_conform == "true") { if (inputs.force_conform == "true") {
if (inputs.container.toLowerCase() == "mkv") { if (inputs.container.toLowerCase() == "mkv") {
extraArguments += `-map -0:d `; extraArguments += `-map -0:d `;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (var i = 0; i < file.ffProbeData.streams.length; i++)
if ( try {
file.ffProbeData.streams[i].codec_name if (
.toLowerCase() == "mov_text" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "mov_text" ||
.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "eia_608" ||
.toLowerCase() == "timed_id3" file.ffProbeData.streams[i].codec_name
) { .toLowerCase() == "timed_id3"
extraArguments += `-map -0:${i} `; ) {
} extraArguments += `-map -0:${i} `;
} }
} catch (err) {}
} }
if (inputs.container.toLowerCase() == "mp4") { if (inputs.container.toLowerCase() == "mp4") {
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (var i = 0; i < file.ffProbeData.streams.length; i++)
if ( try {
file.ffProbeData.streams[i].codec_name if (
.toLowerCase() == "hdmv_pgs_subtitle" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "hdmv_pgs_subtitle" ||
.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "eia_608" ||
.toLowerCase() == "subrip" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "subrip" ||
.toLowerCase() == "timed_id3" file.ffProbeData.streams[i].codec_name
) { .toLowerCase() == "timed_id3"
extraArguments += `-map -0:${i} `; ) {
} extraArguments += `-map -0:${i} `;
} }
} catch (err) {}
} }
} }

@ -6,7 +6,7 @@ function details() {
Type: "Video", Type: "Video",
Operation: "Transcode", Operation: "Transcode",
Description: `Files not in H265 will be transcoded into H265 using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`, Description: `Files not in H265 will be transcoded into H265 using CPU with ffmpeg, settings are dependant on file bitrate, working by the logic that H265 can support the same ammount of data at half the bitrate of H264. \n\n`,
Version: "1.5", Version: "1.6",
Link: Link:
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js", "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js",
Tags: "pre-processing,ffmpeg,video only,configurable,h265", Tags: "pre-processing,ffmpeg,video only,configurable,h265",
@ -122,34 +122,36 @@ function plugin(file, librarySettings, inputs) {
if (inputs.force_conform == "true") { if (inputs.force_conform == "true") {
if (inputs.container.toLowerCase() == "mkv") { if (inputs.container.toLowerCase() == "mkv") {
extraArguments += `-map -0:d `; extraArguments += `-map -0:d `;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (var i = 0; i < file.ffProbeData.streams.length; i++)
if ( try {
file.ffProbeData.streams[i].codec_name if (
.toLowerCase() == "mov_text" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "mov_text" ||
.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "eia_608" ||
.toLowerCase() == "timed_id3" file.ffProbeData.streams[i].codec_name
) { .toLowerCase() == "timed_id3"
extraArguments += `-map -0:${i} `; ) {
} extraArguments += `-map -0:${i} `;
} }
} catch (err) {}
} }
if (inputs.container.toLowerCase() == "mp4") { if (inputs.container.toLowerCase() == "mp4") {
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (var i = 0; i < file.ffProbeData.streams.length; i++)
if ( try {
file.ffProbeData.streams[i].codec_name if (
.toLowerCase() == "hdmv_pgs_subtitle" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "hdmv_pgs_subtitle" ||
.toLowerCase() == "eia_608" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "eia_608" ||
.toLowerCase() == "subrip" || file.ffProbeData.streams[i].codec_name
file.ffProbeData.streams[i].codec_name .toLowerCase() == "subrip" ||
.toLowerCase() == "timed_id3" file.ffProbeData.streams[i].codec_name
) { .toLowerCase() == "timed_id3"
extraArguments += `-map -0:${i} `; ) {
} extraArguments += `-map -0:${i} `;
} }
} catch (err) {}
} }
} }

@ -6,7 +6,7 @@ function details() {
Type: "Video", Type: "Video",
Operation: "Clean", 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`, 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.3", Version: "1.4",
Link: Link:
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js",
Tags: "pre-processing,ffmpeg,configurable", Tags: "pre-processing,ffmpeg,configurable",
@ -28,6 +28,15 @@ function details() {
\\nExample:\\n \\nExample:\\n
false`, false`,
},
{
name: "custom_title_matching",
tooltip: `By default if you enable audio or subtitle cleaning the plugin only looks for titles with more then 3 full stops, this is what i think is the safest way to identify junk metadata without removing real metadata that you might want to keep. Here you can specify your own text for it to also search for to match and remove. Comma separated. Optional.
\\nExample:\\n
MiNX - Small HD episodes
\\nExample:\\n
MiNX - Small HD episodes,GalaxyTV - small excellence!`,
}, },
], ],
}; };
@ -45,11 +54,17 @@ function plugin(file, librarySettings, inputs) {
}; };
// Set up required variables. // Set up required variables.
var ffmpegCommandInsert = ""; var ffmpegCommandInsert = "";
var videoIdx = 0; var videoIdx = 0;
var audioIdx = 0; var audioIdx = 0;
var subtitleIdx = 0; var subtitleIdx = 0;
var convert = false; var convert = false;
// Check if inputs.custom_title_matching has been configured. If it has then set variable
if (inputs.custom_title_matching != "") {
var custom_title_matching = inputs.custom_title_matching.toLowerCase().split(",");
}
// Check if file is a video. If it isn't then exit plugin. // Check if file is a video. If it isn't then exit plugin.
if (file.fileMedium !== "video") { if (file.fileMedium !== "video") {
@ -81,7 +96,7 @@ function plugin(file, librarySettings, inputs) {
videoIdx++; videoIdx++;
} }
// 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. // 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. Then check if any audio streams match with user input custom_title_matching variable, if so then remove.
if ( if (
file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" &&
inputs.clean_audio.toLowerCase() == "true" inputs.clean_audio.toLowerCase() == "true"
@ -90,12 +105,17 @@ function plugin(file, librarySettings, inputs) {
response.infoLog += `☒More then 3 full stops detected in audio title, likely to be junk metadata. Removing title from stream ${i} \n`; 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="" `; ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" `;
convert = true; convert = true;
}
if (custom_title_matching.indexOf(file.ffProbeData.streams[i].tags.title.toLowerCase()) !== -1) {
response.infoLog += `☒Audio matched custom input. Removing title from stream ${i} \n`;
ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" `;
convert = true;
} }
// Increment audioIdx. // Increment audioIdx.
audioIdx++; audioIdx++;
} }
// 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. // 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. Then check if any audio streams match with user input custom_title_matching variable, if so then remove.
if ( if (
file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" && file.ffProbeData.streams[i].codec_type.toLowerCase() == "subtitle" &&
inputs.clean_subtitles.toLowerCase() == "true" inputs.clean_subtitles.toLowerCase() == "true"
@ -104,6 +124,11 @@ function plugin(file, librarySettings, inputs) {
response.infoLog += `☒More then 3 full stops detected in subtitle title, likely to be junk metadata. Removing title from stream ${i} \n`; 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="" `; ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" `;
convert = true; convert = true;
}
if (custom_title_matching.indexOf(file.ffProbeData.streams[i].tags.title.toLowerCase()) !== -1) {
response.infoLog += `☒Subtitle matched custom input. Removing title from stream ${i} \n`;
ffmpegCommandInsert += ` -metadata:s:s:${subtitleIdx} title="" `;
convert = true;
} }
// Increment subtitleIdx. // Increment subtitleIdx.
subtitleIdx++; subtitleIdx++;

Loading…
Cancel
Save