From 90f3364929aac72348f80e66b1452bb3d3fda7ad Mon Sep 17 00:00:00 2001 From: Jack Dallas <3620144+JackDallas@users.noreply.github.com> Date: Mon, 13 Jan 2020 10:57:17 +0000 Subject: [PATCH 1/3] Fix id's of TheRealShadoh plugins --- .../Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index 7d2814a..3351eb5 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -1,4 +1,3 @@ -/* eslint-disable */ function details() { return { id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", From 1ba2af0145d5a5c99dae78358d4b0eec2eca8968 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 10 Dec 2020 18:03:29 +0100 Subject: [PATCH 2/3] Enable lint --- .../Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 1 - .../Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 1 - .../Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 1 - 3 files changed, 3 deletions(-) diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index 4f008b1..94a6aef 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -1,4 +1,3 @@ -/* eslint-disable */ function details() { return { id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", diff --git a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index 6523383..a4d4cfd 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -1,4 +1,3 @@ -/* eslint-disable */ function details() { return { id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", diff --git a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 76b70c0..2ed1841 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -1,4 +1,3 @@ -/* eslint-disable */ function details() { return { id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", From 82f8e3ce0d85a05ccbe1b5a681f0f215d60e0fe3 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Sat, 19 Dec 2020 10:17:58 +0100 Subject: [PATCH 3/3] lint fix --- ...b_TheRealShadoh_FFmpeg_Subs_H264_Medium.js | 219 +++++++++-------- ...1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js | 222 +++++++++-------- ...2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js | 222 +++++++++-------- ...TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js | 223 +++++++++--------- 4 files changed, 432 insertions(+), 454 deletions(-) diff --git a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js index 94a6aef..f7895a8 100644 --- a/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js +++ b/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js @@ -1,142 +1,137 @@ function details() { return { - id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", - Stage: "Pre-processing", - Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", - Type: "Video", - Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Medium' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + id: 'Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium', + Stage: 'Pre-processing', + Name: 'TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ', + Type: 'Video', + Description: '[Contains built-in filter] This plugin transcodes into H264 using FFmpeg\'s ' + + '\'Medium\' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata' + + ` (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, - Version: "1.00", + Version: '1.00', Link: - "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js", - Tags: "pre-processing,ffmpeg,h264", + 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/' + + 'Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js', + Tags: 'pre-processing,ffmpeg,h264', }; } function plugin(file) { - //Must return this object + // Must return this object - var response = { + const response = { processFile: false, - preset: "", - container: ".mp4", + preset: '', + container: '.mp4', handBrakeMode: false, FFmpegMode: false, reQueueAfter: false, - infoLog: "", + infoLog: '', }; - if (file.fileMedium !== "video") { - console.log("File is not video"); + if (file.fileMedium !== 'video') { + // eslint-disable-next-line no-console + console.log('File is not video'); - response.infoLog += "☒File is not video \n"; + response.infoLog += '☒File is not video \n'; response.processFile = false; return response; - } else { - var jsonString = JSON.stringify(file); - - var hasSubs = false; - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - let streamData = file.ffProbeData.streams[i]; - if ( - streamData.codec_type.toLowerCase() == "subtitle" && - streamData.codec_name != "mov_text" - ) { - hasSubs = true; - } - } catch (err) {} - } - - if (file.ffProbeData.streams[0].codec_name != "h264") { - response.infoLog += "☒File is not in h264! \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset medium -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File is already in h264! \n"; - } - - /// - - if ( - file.meta.Title != undefined && - !jsonString.includes("aac") && - hasSubs - ) { - response.infoLog += "☒File has title metadata and no aac and subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (!jsonString.includes("aac") && hasSubs) { - response.infoLog += "☒File has no aac track and has subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; + } + const jsonString = JSON.stringify(file); + + let hasSubs = false; + + for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { + try { + const streamData = file.ffProbeData.streams[i]; + if ( + streamData.codec_type.toLowerCase() === 'subtitle' + && streamData.codec_name !== 'mov_text' + ) { + hasSubs = true; + } + } catch (err) { + // err } + } - if (file.meta.Title != undefined && hasSubs) { - response.infoLog += "☒File has title and has subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } + if (file.ffProbeData.streams[0].codec_name !== 'h264') { + response.infoLog += '☒File is not in h264! \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a ' + + '-c:v libx264 -preset medium -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File is already in h264! \n'; + + /// + + if ( + file.meta.Title !== undefined + && !jsonString.includes('aac') + && hasSubs + ) { + response.infoLog += '☒File has title metadata and no aac and subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - /// - if (file.meta.Title != undefined) { - response.infoLog += "☒File has title metadata \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no title metadata \n"; - } + if (!jsonString.includes('aac') && hasSubs) { + response.infoLog += '☒File has no aac track and has subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (!jsonString.includes("aac")) { - response.infoLog += "☒File has no aac track \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has aac track \n"; - } + if (file.meta.Title !== undefined && hasSubs) { + response.infoLog += '☒File has title and has subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (hasSubs) { - response.infoLog += "☒File has incompatible subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no/compatible subs \n"; - } + /// + if (file.meta.Title !== undefined) { + response.infoLog += '☒File has title metadata \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no title metadata \n'; + + if (!jsonString.includes('aac')) { + response.infoLog += '☒File has no aac track \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has aac track \n'; - response.infoLog += "☑File meets conditions! \n"; + if (hasSubs) { + response.infoLog += '☒File has incompatible subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.processFile = true; + response.FFmpegMode = true; return response; } + response.infoLog += '☑File has no/compatible subs \n'; + + response.infoLog += '☑File meets conditions! \n'; + return response; } module.exports.details = details; diff --git a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js index a4d4cfd..80ceffb 100644 --- a/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js +++ b/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js @@ -1,143 +1,137 @@ function details() { return { - id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", - Stage: "Pre-processing", - Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", - Type: "Video", - Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Fast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + id: 'Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast', + Stage: 'Pre-processing', + Name: 'TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ', + Type: 'Video', + Description: '[Contains built-in filter] This plugin transcodes into H264 using ' + + 'FFmpeg\'s \'Fast\' preset if the file is not in H264 already. It maintains all subtitles. ' + + `It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n `, - Version: "1.00", + Version: '1.00', Link: - "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", - Tags: "pre-processing,ffmpeg,h264", + 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/' + + 'Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js', + Tags: 'pre-processing,ffmpeg,h264', }; } function plugin(file) { - //Must return this object + // Must return this object - var response = { + const response = { processFile: false, - preset: "", - container: ".mp4", + preset: '', + container: '.mp4', handBrakeMode: false, FFmpegMode: false, reQueueAfter: false, - infoLog: "", + infoLog: '', }; - if (file.fileMedium !== "video") { - console.log("File is not video"); + if (file.fileMedium !== 'video') { + // eslint-disable-next-line no-console + console.log('File is not video'); - response.infoLog += "☒File is not video \n"; + response.infoLog += '☒File is not video \n'; response.processFile = false; return response; - } else { - var jsonString = JSON.stringify(file); - - var hasSubs = false; - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - let streamData = file.ffProbeData.streams[i]; - if ( - streamData.codec_type.toLowerCase() == "subtitle" && - streamData.codec_name != "mov_text" - ) { - hasSubs = true; - } - } catch (err) {} - } - - if (file.ffProbeData.streams[0].codec_name != "h264") { - response.infoLog += "☒File is not in h264! \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset fast -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File is already in h264! \n"; - } - - /// - - if ( - file.meta.Title != undefined && - !jsonString.includes("aac") && - hasSubs - ) { - response.infoLog += "☒File has title metadata and no aac and subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (!jsonString.includes("aac") && hasSubs) { - response.infoLog += "☒File has no aac track and has subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (file.meta.Title != undefined && hasSubs) { - response.infoLog += "☒File has title and has subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; + } + const jsonString = JSON.stringify(file); + + let hasSubs = false; + + for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { + try { + const streamData = file.ffProbeData.streams[i]; + if ( + streamData.codec_type.toLowerCase() === 'subtitle' + && streamData.codec_name !== 'mov_text' + ) { + hasSubs = true; + } + } catch (err) { + // err } + } - /// - if (file.meta.Title != undefined) { - response.infoLog += "☒File has title metadata \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no title metadata \n"; - } + if (file.ffProbeData.streams[0].codec_name !== 'h264') { + response.infoLog += '☒File is not in h264! \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset fast -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File is already in h264! \n'; + + /// + + if ( + file.meta.Title !== undefined + && !jsonString.includes('aac') + && hasSubs + ) { + response.infoLog += '☒File has title metadata and no aac and subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (!jsonString.includes("aac")) { - response.infoLog += "☒File has no aac track \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has aac track \n"; - } + if (!jsonString.includes('aac') && hasSubs) { + response.infoLog += '☒File has no aac track and has subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (hasSubs) { - response.infoLog += "☒File has incompatible subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no/compatible subs \n"; - } + if (file.meta.Title !== undefined && hasSubs) { + response.infoLog += '☒File has title and has subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - response.infoLog += "☑File meets conditions! \n"; + /// + if (file.meta.Title !== undefined) { + response.infoLog += '☒File has title metadata \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no title metadata \n'; + + if (!jsonString.includes('aac')) { + response.infoLog += '☒File has no aac track \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; return response; } + response.infoLog += '☑File has aac track \n'; + + if (hasSubs) { + response.infoLog += '☒File has incompatible subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no/compatible subs \n'; + + response.infoLog += '☑File meets conditions! \n'; + return response; } module.exports.details = details; diff --git a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js index 2ed1841..7f75aea 100644 --- a/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js +++ b/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js @@ -1,143 +1,137 @@ function details() { return { - id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", - Stage: "Pre-processing", - Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", - Type: "Video", - Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'Slow' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + id: 'Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow', + Stage: 'Pre-processing', + Name: 'TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ', + Type: 'Video', + Description: '[Contains built-in filter] This plugin transcodes into H264 using FFmpeg\'s \'Slow\' preset' + + ' if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), ' + + `and maintains all audio tracks. The output container is MP4. \n\n `, - Version: "1.00", + Version: '1.00', Link: - "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", - Tags: "pre-processing,ffmpeg,h264", + 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/' + + 'Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js', + Tags: 'pre-processing,ffmpeg,h264', }; } function plugin(file) { - //Must return this object + // Must return this object - var response = { + const response = { processFile: false, - preset: "", - container: ".mp4", + preset: '', + container: '.mp4', handBrakeMode: false, FFmpegMode: false, reQueueAfter: false, - infoLog: "", + infoLog: '', }; - if (file.fileMedium !== "video") { - console.log("File is not video"); + if (file.fileMedium !== 'video') { + // eslint-disable-next-line no-console + console.log('File is not video'); - response.infoLog += "☒File is not video \n"; + response.infoLog += '☒File is not video \n'; response.processFile = false; return response; - } else { - var jsonString = JSON.stringify(file); - - var hasSubs = false; - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - let streamData = file.ffProbeData.streams[i]; - if ( - streamData.codec_type.toLowerCase() == "subtitle" && - streamData.codec_name != "mov_text" - ) { - hasSubs = true; - } - } catch (err) {} - } - - if (file.ffProbeData.streams[0].codec_name != "h264") { - response.infoLog += "☒File is not in h264! \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset slow -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File is already in h264! \n"; - } - - /// - - if ( - file.meta.Title != undefined && - !jsonString.includes("aac") && - hasSubs - ) { - response.infoLog += "☒File has title metadata and no aac and subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (!jsonString.includes("aac") && hasSubs) { - response.infoLog += "☒File has no aac track and has subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (file.meta.Title != undefined && hasSubs) { - response.infoLog += "☒File has title and has subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; + } + const jsonString = JSON.stringify(file); + + let hasSubs = false; + + for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { + try { + const streamData = file.ffProbeData.streams[i]; + if ( + streamData.codec_type.toLowerCase() === 'subtitle' + && streamData.codec_name !== 'mov_text' + ) { + hasSubs = true; + } + } catch (err) { + // err } + } - /// - if (file.meta.Title != undefined) { - response.infoLog += "☒File has title metadata \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no title metadata \n"; - } + if (file.ffProbeData.streams[0].codec_name !== 'h264') { + response.infoLog += '☒File is not in h264! \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset slow -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File is already in h264! \n'; + + /// + + if ( + file.meta.Title !== undefined + && !jsonString.includes('aac') + && hasSubs + ) { + response.infoLog += '☒File has title metadata and no aac and subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (!jsonString.includes("aac")) { - response.infoLog += "☒File has no aac track \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has aac track \n"; - } + if (!jsonString.includes('aac') && hasSubs) { + response.infoLog += '☒File has no aac track and has subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (hasSubs) { - response.infoLog += "☒File has incompatible subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no/compatible subs \n"; - } + if (file.meta.Title !== undefined && hasSubs) { + response.infoLog += '☒File has title and has subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - response.infoLog += "☑File meets conditions! \n"; + /// + if (file.meta.Title !== undefined) { + response.infoLog += '☒File has title metadata \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no title metadata \n'; + + if (!jsonString.includes('aac')) { + response.infoLog += '☒File has no aac track \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; return response; } + response.infoLog += '☑File has aac track \n'; + + if (hasSubs) { + response.infoLog += '☒File has incompatible subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no/compatible subs \n'; + + response.infoLog += '☑File meets conditions! \n'; + return response; } module.exports.details = details; diff --git a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js index 3351eb5..b0675bc 100644 --- a/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js +++ b/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast.js @@ -1,144 +1,139 @@ function details() { return { - id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", - Stage: "Pre-processing", + id: 'Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast', + Stage: 'Pre-processing', Name: - "TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", - Type: "Video", - Description: `[Contains built-in filter] This plugin transcodes into H264 using FFmpeg's 'VeryFast' preset if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), and maintains all audio tracks. The output container is MP4. \n\n + 'TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ', + Type: 'Video', + Description: '[Contains built-in filter] This plugin transcodes into H264 using FFmpeg\'s \'VeryFast\' preset ' + + 'if the file is not in H264 already. It maintains all subtitles. It removes metadata (if a title exists), ' + + `and maintains all audio tracks. The output container is MP4. \n\n `, - Version: "1.00", + Version: '1.00', Link: - "https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js", - Tags: "pre-processing,ffmpeg,h264", + 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/' + + 'Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js', + Tags: 'pre-processing,ffmpeg,h264', }; } function plugin(file) { - //Must return this object + // Must return this object - var response = { + const response = { processFile: false, - preset: "", - container: ".mp4", + preset: '', + container: '.mp4', handBrakeMode: false, FFmpegMode: false, reQueueAfter: false, - infoLog: "", + infoLog: '', }; - if (file.fileMedium !== "video") { - console.log("File is not video"); + if (file.fileMedium !== 'video') { + // eslint-disable-next-line no-console + console.log('File is not video'); - response.infoLog += "☒File is not video \n"; + response.infoLog += '☒File is not video \n'; response.processFile = false; return response; - } else { - var jsonString = JSON.stringify(file); - - var hasSubs = false; - - for (var i = 0; i < file.ffProbeData.streams.length; i++) { - try { - let streamData = file.ffProbeData.streams[i]; - if ( - streamData.codec_type.toLowerCase() == "subtitle" && - streamData.codec_name != "mov_text" - ) { - hasSubs = true; - } - } catch (err) {} - } - - if (file.ffProbeData.streams[0].codec_name != "h264") { - response.infoLog += "☒File is not in h264! \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v libx264 -preset veryfast -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File is already in h264! \n"; - } - - /// - - if ( - file.meta.Title != undefined && - !jsonString.includes("aac") && - hasSubs - ) { - response.infoLog += "☒File has title metadata and no aac and subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (!jsonString.includes("aac") && hasSubs) { - response.infoLog += "☒File has no aac track and has subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } - - if (file.meta.Title != undefined && hasSubs) { - response.infoLog += "☒File has title and has subs \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; + } + const jsonString = JSON.stringify(file); + + let hasSubs = false; + + for (let i = 0; i < file.ffProbeData.streams.length; i += 1) { + try { + const streamData = file.ffProbeData.streams[i]; + if ( + streamData.codec_type.toLowerCase() === 'subtitle' + && streamData.codec_name !== 'mov_text' + ) { + hasSubs = true; + } + } catch (err) { + // err } + } - /// - if (file.meta.Title != undefined) { - response.infoLog += "☒File has title metadata \n"; - response.preset = - ", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no title metadata \n"; - } + if (file.ffProbeData.streams[0].codec_name !== 'h264') { + response.infoLog += '☒File is not in h264! \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? ' + + '-map 0:a -c:v libx264 -preset veryfast -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File is already in h264! \n'; + + /// + + if ( + file.meta.Title !== undefined + && !jsonString.includes('aac') + && hasSubs + ) { + response.infoLog += '☒File has title metadata and no aac and subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (!jsonString.includes("aac")) { - response.infoLog += "☒File has no aac track \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has aac track \n"; - } + if (!jsonString.includes('aac') && hasSubs) { + response.infoLog += '☒File has no aac track and has subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - if (hasSubs) { - response.infoLog += "☒File has incompatible subs \n"; - response.preset = - ", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; - response.reQueueAfter = true; - response.processFile = true; - response.FFmpegMode = true; - return response; - } else { - response.infoLog += "☑File has no/compatible subs \n"; - } + if (file.meta.Title !== undefined && hasSubs) { + response.infoLog += '☒File has title and has subs \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } - response.infoLog += "☑File meets conditions! \n"; + /// + if (file.meta.Title !== undefined) { + response.infoLog += '☒File has title metadata \n'; + response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no title metadata \n'; + + if (!jsonString.includes('aac')) { + response.infoLog += '☒File has no aac track \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; return response; } + response.infoLog += '☑File has aac track \n'; + + if (hasSubs) { + response.infoLog += '☒File has incompatible subs \n'; + response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text'; + response.reQueueAfter = true; + response.processFile = true; + response.FFmpegMode = true; + return response; + } + response.infoLog += '☑File has no/compatible subs \n'; + + response.infoLog += '☑File meets conditions! \n'; + return response; } module.exports.details = details;