commit
67e4f71b43
@ -1,62 +1,51 @@
|
||||
/* eslint-disable */
|
||||
function details() {
|
||||
return {
|
||||
id: "Tdarr_Plugin_x7ac_Remove_Closed_Captions",
|
||||
Stage: "Pre-processing",
|
||||
Name: "Remove closed captions",
|
||||
Type: "Video",
|
||||
Operation: "Remux",
|
||||
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.",
|
||||
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/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js",
|
||||
Tags: "pre-processing,ffmpeg,subtitle only",
|
||||
'https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_x7ac_Remove_Closed_Captions.js',
|
||||
Tags: 'pre-processing,ffmpeg,subtitle only',
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
const response = {
|
||||
processFile: false,
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
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,
|
||||
// eslint-disable-next-line no-useless-escape
|
||||
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",
|
||||
infoLog: '',
|
||||
};
|
||||
|
||||
if (file.fileMedium !== 'video') {
|
||||
response.infoLog += '☒File is not video \n';
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog +=
|
||||
"☑Closed captions have not been detected on this file \n";
|
||||
response.processFile = false;
|
||||
|
||||
}
|
||||
// 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.plugin = plugin;
|
||||
|
||||
@ -0,0 +1,37 @@
|
||||
module.exports.details = function details() {
|
||||
return {
|
||||
id: 'Tdarr_Plugin_a9he_New_file_size_check',
|
||||
Stage: 'Pre-processing',
|
||||
Name: 'New file size check',
|
||||
Type: 'Video',
|
||||
Operation: 'Transcode',
|
||||
Description: 'Give an error if new file is larger than the original \n\n',
|
||||
Version: '1.00',
|
||||
Link: '',
|
||||
Tags: '',
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.plugin = function plugin(file, librarySettings, inputs, otherArguments) {
|
||||
// Must return this object at some point in the function else plugin will fail.
|
||||
const response = {
|
||||
processFile: false,
|
||||
preset: '',
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: true,
|
||||
reQueueAfter: true,
|
||||
infoLog: '',
|
||||
};
|
||||
|
||||
const newSize = file.file_size;
|
||||
const oldSize = otherArguments.originalLibraryFile.file_size;
|
||||
if (newSize > oldSize) {
|
||||
// Item will be errored in UI
|
||||
throw new Error(`Error! New file has size ${newSize} which is larger than original file ${oldSize}`);
|
||||
} else if (newSize < oldSize) {
|
||||
response.infoLog += `New file has size ${newSize} which is smaller than original file ${oldSize}`;
|
||||
}
|
||||
// if file sizes are exactly the same then file has not been transcoded yet
|
||||
|
||||
return response;
|
||||
};
|
||||
@ -0,0 +1,35 @@
|
||||
module.exports.details = function details() {
|
||||
return {
|
||||
id: 'Tdarr_Plugin_bbbc_Filter_Example',
|
||||
Stage: 'Pre-processing',
|
||||
Name: 'Filter resolutions',
|
||||
Type: 'Video',
|
||||
Operation: 'Filter',
|
||||
Description: 'This plugin prevents processing files with specified resolutions \n\n',
|
||||
Version: '1.00',
|
||||
Link: '',
|
||||
Tags: '',
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.plugin = function plugin(file) {
|
||||
const response = {
|
||||
processFile: true,
|
||||
infoLog: '',
|
||||
};
|
||||
|
||||
const resolutionsToSkip = [
|
||||
'1080p',
|
||||
'4KUHD',
|
||||
];
|
||||
|
||||
for (let i = 0; i < resolutionsToSkip.length; i += 1) {
|
||||
if (file.video_resolution === resolutionsToSkip[i]) {
|
||||
response.processFile = false;
|
||||
response.infoLog += `Filter preventing processing. File has resolution ${resolutionsToSkip[i]}`;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
Loading…
Reference in new issue