From 1ef47b8d7850c326119fb63dff63b4e55e55f75d Mon Sep 17 00:00:00 2001 From: Migz93 <33037112+Migz93@users.noreply.github.com> Date: Tue, 20 Oct 2020 15:33:46 +0100 Subject: [PATCH] BugFix Update Update to catch error if custom_title_matching is empty. --- Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js index 993ef94..d243c13 100644 --- a/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js +++ b/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js @@ -6,7 +6,7 @@ function details() { 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.4", + Version: "1.6", Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_MC93_Migz2CleanTitle.js", Tags: "pre-processing,ffmpeg,configurable", @@ -62,9 +62,10 @@ function plugin(file, librarySettings, inputs) { var convert = false; // Check if inputs.custom_title_matching has been configured. If it has then set variable - if (inputs.custom_title_matching != "") { + if (inputs.custom_title_matching != "") + try { var custom_title_matching = inputs.custom_title_matching.toLowerCase().split(","); - } + } catch (err) {} // Check if file is a video. If it isn't then exit plugin. if (file.fileMedium !== "video") { @@ -86,7 +87,7 @@ function plugin(file, librarySettings, inputs) { try { // Check if stream is a video. if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "video") { - // Check if stream title is not empty, if it's nto empty set to "". + // Check if stream title is not empty, if it's not 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="" `; @@ -106,7 +107,7 @@ function plugin(file, librarySettings, inputs) { ffmpegCommandInsert += ` -metadata:s:a:${audioIdx} title="" `; convert = true; } - if (custom_title_matching.indexOf(file.ffProbeData.streams[i].tags.title.toLowerCase()) !== -1) { + 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;