From b265e586e873a0b7cadd4f6cb162f418720b1ca0 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 8 Aug 2022 23:52:05 +0100 Subject: [PATCH] Catch lowercase bug --- Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js | 8 +++++++- Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js index 11edf36..a8e47dd 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG.js @@ -249,7 +249,13 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { // Go through each stream in the file. for (let i = 0; i < file.ffProbeData.streams.length; i++) { // Check if stream is a video. - if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'video') { + let codec_type = ''; + try { + codec_type = file.ffProbeData.streams[i].codec_type.toLowerCase(); + } catch (err) { + // err + } + if (codec_type === 'video') { // Check if codec of stream is mjpeg/png, if so then remove this "video" stream. // mjpeg/png are usually embedded pictures that can cause havoc with plugins. if (file.ffProbeData.streams[i].codec_name === 'mjpeg' || file.ffProbeData.streams[i].codec_name === 'png') { diff --git a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js index a5abfcb..6e68585 100644 --- a/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js +++ b/Community/Tdarr_Plugin_MC93_Migz1FFMPEG_CPU.js @@ -216,7 +216,13 @@ const plugin = (file, librarySettings, inputs, otherArguments) => { // Go through each stream in the file. for (let i = 0; i < file.ffProbeData.streams.length; i++) { // Check if stream is a video. - if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'video') { + let codec_type = ''; + try { + codec_type = file.ffProbeData.streams[i].codec_type.toLowerCase(); + } catch (err) { + // err + } + if (codec_type === 'video') { // Check if codec of stream is mjpeg/png. // If so then remove this "video" stream. // mjpeg/png are usually embedded pictures that can cause havoc with plugins.