Merge pull request #198 from wsegatto/master
Update Tdarr_Plugin_x7ac_Remove_Closed_Captions.jsmake-only-subtitle-default
commit
4597d90b3f
@ -1,62 +1,51 @@
|
|||||||
/* eslint-disable */
|
|
||||||
function details() {
|
function details() {
|
||||||
return {
|
return {
|
||||||
id: "Tdarr_Plugin_x7ac_Remove_Closed_Captions",
|
id: 'Tdarr_Plugin_x7ac_Remove_Closed_Captions',
|
||||||
Stage: "Pre-processing",
|
Stage: 'Pre-processing',
|
||||||
Name: "Remove closed captions",
|
Name: 'Remove burned closed captions',
|
||||||
Type: "Video",
|
Type: 'Video',
|
||||||
Operation: "Remux",
|
Operation: 'Remux',
|
||||||
Description:
|
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 from streams.',
|
||||||
Version: "1.00",
|
Version: '1.01',
|
||||||
Link:
|
Link:
|
||||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js",
|
'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js',
|
||||||
Tags: "pre-processing,ffmpeg,subtitle only",
|
Tags: 'pre-processing,ffmpeg,subtitle only',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin(file) {
|
function plugin(file) {
|
||||||
//Must return this object
|
const response = {
|
||||||
|
|
||||||
var response = {
|
|
||||||
processFile: false,
|
processFile: false,
|
||||||
preset: "",
|
// eslint-disable-next-line no-useless-escape
|
||||||
container: ".mp4",
|
preset: ',-map 0 -codec copy -bsf:v \"filter_units=remove_types=6\"',
|
||||||
|
container: `.${file.container}`,
|
||||||
handBrakeMode: false,
|
handBrakeMode: false,
|
||||||
FFmpegMode: false,
|
FFmpegMode: true,
|
||||||
reQueueAfter: true,
|
reQueueAfter: true,
|
||||||
infoLog: "",
|
infoLog: '',
|
||||||
};
|
};
|
||||||
|
if (file.fileMedium !== 'video') {
|
||||||
if (file.fileMedium !== "video") {
|
response.infoLog += '☒File is not video \n';
|
||||||
console.log("File is not video");
|
|
||||||
|
|
||||||
response.infoLog += "☒File is not video \n";
|
|
||||||
response.processFile = false;
|
|
||||||
|
|
||||||
return response;
|
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
|
||||||
|
const { streams } = file.ffProbeData;
|
||||||
|
streams.forEach((stream) => {
|
||||||
|
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;
|
module.exports.details = details;
|
||||||
module.exports.plugin = plugin;
|
module.exports.plugin = plugin;
|
||||||
|
|||||||
Loading…
Reference in new issue