From 25b67c2cfac35d10ce770c9f26ca94dd2726131a Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Sat, 13 Nov 2021 15:10:21 -0300 Subject: [PATCH 01/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- ...darr_Plugin_x7ac_Remove_Closed_Captions.js | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 730b884..ec84c9b 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -1,4 +1,3 @@ -/* eslint-disable */ function details() { return { id: "Tdarr_Plugin_x7ac_Remove_Closed_Captions", @@ -16,46 +15,39 @@ function details() { } function plugin(file) { - //Must return this object - - var response = { + const response = { processFile: false, - preset: "", - container: ".mp4", + preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"', + container: "." + file.container, handBrakeMode: false, - FFmpegMode: false, + FFmpegMode: true, reQueueAfter: true, infoLog: "", }; if (file.fileMedium !== "video") { - console.log("File is not video"); - response.infoLog += "☒File is not video \n"; - response.processFile = false; - return response; - } else { - if (file.hasClosedCaptions === true) { - response = { - processFile: true, - preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"', - container: "." + file.container, - handBrakeMode: false, - FFmpegMode: true, - reQueueAfter: true, - infoLog: "☒This file has closed captions \n", - }; - - return response; - } else { - response.infoLog += - "☑Closed captions have not been detected on this file \n"; - response.processFile = false; + } - return response; + //Check if Closed Captions are set at file level + if (file.hasClosedCaptions) { + response.processFile = true; + response.infoLog += '☒This file has closed captions \n'; + return response; + } + //If not, check for Closed Captions in the streams + for (const stream in file.ffProbeData.streams) { + if (stream.closed_captions) { + response.processFile = true; } } + + response.infoLog += + response.processFile ? '☒This file has burnt closed captions \n' + : '☑Closed captions have not been detected on this file \n'; + + return response; } module.exports.details = details; From 04b001baa7f78bfe1975a4fac5c1fbaafabaca4e Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Sat, 13 Nov 2021 18:52:19 -0300 Subject: [PATCH 02/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- ...darr_Plugin_x7ac_Remove_Closed_Captions.js | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index ec84c9b..be6fc29 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -1,16 +1,16 @@ function details() { return { - id: "Tdarr_Plugin_x7ac_Remove_Closed_Captions", - Stage: "Pre-processing", - Name: "Remove closed captions", - Type: "Video", - Operation: "Remux", + id: 'Tdarr_Plugin_WS_Remove_Closed_Captions', + Stage: 'Pre-processing', + Name: 'Remove burned closed captions', + Type: 'Video', + Operation: 'Remux', Description: - "[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed.", + '[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed. Derived from x7ac Closed Captions plugin.', Version: "1.00", Link: - "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js", - Tags: "pre-processing,ffmpeg,subtitle only", + 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/', + Tags: 'pre-processing,ffmpeg,subtitle only', }; } @@ -18,25 +18,25 @@ function plugin(file) { const response = { processFile: false, preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"', - container: "." + file.container, + container: '.' + file.container, handBrakeMode: false, FFmpegMode: true, reQueueAfter: true, - infoLog: "", + infoLog: '', }; - if (file.fileMedium !== "video") { - response.infoLog += "☒File is not video \n"; + if (file.fileMedium !== 'video') { + response.infoLog += '☒File is not video \n'; return response; } - //Check if Closed Captions are set at file level + // Check if Closed Captions are set at file level if (file.hasClosedCaptions) { response.processFile = true; response.infoLog += '☒This file has closed captions \n'; return response; } - //If not, check for Closed Captions in the streams + // If not, check for Closed Captions in the streams for (const stream in file.ffProbeData.streams) { if (stream.closed_captions) { response.processFile = true; @@ -51,4 +51,4 @@ function plugin(file) { } module.exports.details = details; -module.exports.plugin = plugin; +module.exports.plugin = plugin; \ No newline at end of file From 2ff96a98ea559ddc10685ee4c02594c4787908f5 Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Mon, 15 Nov 2021 23:33:41 -0300 Subject: [PATCH 03/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index be6fc29..c347271 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -1,15 +1,15 @@ function details() { return { - id: 'Tdarr_Plugin_WS_Remove_Closed_Captions', + id: 'Tdarr_Plugin_x7ac_Remove_Closed_Captions', Stage: 'Pre-processing', Name: 'Remove burned closed captions', Type: 'Video', Operation: 'Remux', Description: - '[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed. Derived from x7ac Closed Captions plugin.', - Version: "1.00", + '[Contains built-in filter] If detected, closed captions (XDS,608,708) will be removed from streams.', + Version: '1.01', Link: - 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/', + 'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js', Tags: 'pre-processing,ffmpeg,subtitle only', }; } From 943da9aa5f8e7b8627df6fcca564d8df9a8f310f Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Wed, 17 Nov 2021 13:34:04 -0300 Subject: [PATCH 04/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index c347271..4fde8ac 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -43,12 +43,9 @@ function plugin(file) { } } - response.infoLog += - response.processFile ? '☒This file has burnt closed captions \n' - : '☑Closed captions have not been detected on this file \n'; + response.infoLog += response.processFile?'☒This file has burnt closed captions \n':'☑Closed captions have not been detected on this file \n'; return response; } - module.exports.details = details; -module.exports.plugin = plugin; \ No newline at end of file +module.exports.plugin = plugin; From 722f14d3d1e57b28032fa258508be36c8fc629ae Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Thu, 25 Nov 2021 11:21:59 -0300 Subject: [PATCH 05/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- .../Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 4fde8ac..0a0b4be 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -18,18 +18,16 @@ function plugin(file) { const response = { processFile: false, preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"', - container: '.' + file.container, + container: '.${file.container}', handBrakeMode: false, FFmpegMode: true, reQueueAfter: true, infoLog: '', }; - if (file.fileMedium !== 'video') { response.infoLog += '☒File is not video \n'; return response; } - // Check if Closed Captions are set at file level if (file.hasClosedCaptions) { response.processFile = true; @@ -37,14 +35,15 @@ function plugin(file) { return response; } // If not, check for Closed Captions in the streams - for (const stream in file.ffProbeData.streams) { + var streams = file.ffProbeData.streams; + for (const stream in streams) { if (stream.closed_captions) { response.processFile = true; + break; } } - - response.infoLog += response.processFile?'☒This file has burnt closed captions \n':'☑Closed captions have not been detected on this file \n'; - + response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' : + '☑Closed captions have not been detected on this file \n'; return response; } module.exports.details = details; From 3acaafef5f066e9b3c23e5990035579e2ad517f4 Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Wed, 8 Dec 2021 11:54:23 -0300 Subject: [PATCH 06/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 0a0b4be..843057d 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -17,7 +17,7 @@ function details() { function plugin(file) { const response = { processFile: false, - preset: ',-map 0 -codec copy -bsf:v "filter_units=remove_types=6"', + preset: `,-map 0 -codec copy -bsf:v "filter_units=remove_types=6"`, container: '.${file.container}', handBrakeMode: false, FFmpegMode: true, From 07c75473e0a6554b497b9cf13b8afefd6789f0f5 Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Wed, 8 Dec 2021 12:01:59 -0300 Subject: [PATCH 07/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 843057d..85fd185 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -17,7 +17,7 @@ function details() { function plugin(file) { const response = { processFile: false, - preset: `,-map 0 -codec copy -bsf:v "filter_units=remove_types=6"`, + preset: `,-map 0 -codec copy -bsf:v 'filter_units=remove_types=6'`, container: '.${file.container}', handBrakeMode: false, FFmpegMode: true, @@ -35,7 +35,7 @@ function plugin(file) { return response; } // If not, check for Closed Captions in the streams - var streams = file.ffProbeData.streams; + const streams = file.ffProbeData.streams; for (const stream in streams) { if (stream.closed_captions) { response.processFile = true; From a4014582890b590ac3cd1c83d351bdd5648b9854 Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Wed, 8 Dec 2021 12:03:55 -0300 Subject: [PATCH 08/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 85fd185..66f9a84 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -43,7 +43,7 @@ function plugin(file) { } } response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' : - '☑Closed captions have not been detected on this file \n'; + '☑Closed captions have not been detected on this file \n'; return response; } module.exports.details = details; From 79bce89388da64dc0c91f25c0fcd00aa5585ca84 Mon Sep 17 00:00:00 2001 From: Will Segatto Date: Wed, 8 Dec 2021 17:44:24 -0300 Subject: [PATCH 09/10] Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.js --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 66f9a84..45ad864 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -17,8 +17,8 @@ function details() { function plugin(file) { const response = { processFile: false, - preset: `,-map 0 -codec copy -bsf:v 'filter_units=remove_types=6'`, - container: '.${file.container}', + preset: ',-map 0 -codec copy -bsf:v \"filter_units=remove_types=6\"', + container: `.${file.container}`, handBrakeMode: false, FFmpegMode: true, reQueueAfter: true, @@ -35,15 +35,15 @@ function plugin(file) { return response; } // If not, check for Closed Captions in the streams - const streams = file.ffProbeData.streams; + const {streams} = file.ffProbeData; for (const stream in streams) { if (stream.closed_captions) { response.processFile = true; break; } } - response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' : - '☑Closed captions have not been detected on this file \n'; + response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' + : '☑Closed captions have not been detected on this file \n'; return response; } module.exports.details = details; From a2dd698acd18a9052dc10f8bd158fac11797d355 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Thu, 9 Dec 2021 07:34:59 +0000 Subject: [PATCH 10/10] Fix lint --- Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js index 45ad864..8918a4e 100644 --- a/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js +++ b/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js @@ -17,6 +17,7 @@ function details() { function plugin(file) { const response = { processFile: false, + // eslint-disable-next-line no-useless-escape preset: ',-map 0 -codec copy -bsf:v \"filter_units=remove_types=6\"', container: `.${file.container}`, handBrakeMode: false, @@ -35,14 +36,14 @@ function plugin(file) { return response; } // If not, check for Closed Captions in the streams - const {streams} = file.ffProbeData; - for (const stream in streams) { + const { streams } = file.ffProbeData; + streams.forEach((stream) => { if (stream.closed_captions) { response.processFile = true; - break; } - } - response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' + }); + + response.infoLog += response.processFile ? '☒This file has burnt closed captions \n' : '☑Closed captions have not been detected on this file \n'; return response; }