Merge pull request #114 from TheRealShadoh/master

Accepted JackDallas fix actions
make-only-subtitle-default
HaveAGitGat 5 years ago committed by GitHub
commit 00b9ef0856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,143 +1,137 @@
/* eslint-disable */
function details() { function details() {
return { return {
id: "Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium", id: 'Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium',
Stage: "Pre-processing", Stage: 'Pre-processing',
Name: "TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ", Name: 'TheRealShadoh FFmpeg Subs Medium, video MP4, audio AAC, keep subs. ',
Type: "Video", 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 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: Link:
"https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js", 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/'
Tags: "pre-processing,ffmpeg,h264", + 'Tdarr_Plugin_z0ab_TheRealShadoh_FFmpeg_Subs_H264_Medium.js',
Tags: 'pre-processing,ffmpeg,h264',
}; };
} }
function plugin(file) { function plugin(file) {
//Must return this object // Must return this object
var response = { const response = {
processFile: false, processFile: false,
preset: "", preset: '',
container: ".mp4", container: '.mp4',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: false, FFmpegMode: false,
reQueueAfter: false, reQueueAfter: false,
infoLog: "", infoLog: '',
}; };
if (file.fileMedium !== "video") { if (file.fileMedium !== 'video') {
console.log("File is not 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; response.processFile = false;
return response; return response;
} else { }
var jsonString = JSON.stringify(file); const jsonString = JSON.stringify(file);
var hasSubs = false; let hasSubs = false;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try { try {
let streamData = file.ffProbeData.streams[i]; const streamData = file.ffProbeData.streams[i];
if ( if (
streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_type.toLowerCase() === 'subtitle'
streamData.codec_name != "mov_text" && streamData.codec_name !== 'mov_text'
) { ) {
hasSubs = true; hasSubs = true;
} }
} catch (err) {} } catch (err) {
} // 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;
} }
}
if (file.meta.Title != undefined && hasSubs) { if (file.ffProbeData.streams[0].codec_name !== 'h264') {
response.infoLog += "☒File has title and has subs \n"; response.infoLog += '☒File is not in h264! \n';
response.preset = response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a '
", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; + '-c:v libx264 -preset medium -c:a aac -c:s mov_text';
response.reQueueAfter = true; response.reQueueAfter = true;
response.processFile = true; response.processFile = true;
response.FFmpegMode = true; response.FFmpegMode = true;
return response; 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') && hasSubs) {
if (file.meta.Title != undefined) { response.infoLog += '☒File has no aac track and has subs \n';
response.infoLog += "☒File has title metadata \n"; response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text';
response.preset = response.reQueueAfter = true;
", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.processFile = true;
response.reQueueAfter = true; response.FFmpegMode = true;
response.processFile = true; return response;
response.FFmpegMode = true; }
return response;
} else {
response.infoLog += "☑File has no title metadata \n";
}
if (!jsonString.includes("aac")) { if (file.meta.Title !== undefined && hasSubs) {
response.infoLog += "☒File has no aac track \n"; response.infoLog += '☒File has title and has subs \n';
response.preset = response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has aac track \n";
}
if (hasSubs) { ///
response.infoLog += "☒File has incompatible subs \n"; if (file.meta.Title !== undefined) {
response.preset = response.infoLog += '☒File has title metadata \n';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; 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.processFile = true; response.reQueueAfter = true;
response.FFmpegMode = true; response.processFile = true;
return response; response.FFmpegMode = true;
} else { return response;
response.infoLog += "☑File has no/compatible subs \n"; }
} 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; return response;
} }
response.infoLog += '☑File has no/compatible subs \n';
response.infoLog += '☑File meets conditions! \n';
return response;
} }
module.exports.details = details; module.exports.details = details;

@ -1,144 +1,137 @@
/* eslint-disable */
function details() { function details() {
return { return {
id: "Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast", id: 'Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast',
Stage: "Pre-processing", Stage: 'Pre-processing',
Name: "TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ", Name: 'TheRealShadoh FFmpeg Subs Fast, video MP4, audio AAC, keep subs. ',
Type: "Video", 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 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: Link:
"https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js", 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/'
Tags: "pre-processing,ffmpeg,h264", + 'Tdarr_Plugin_z1ab_TheRealShadoh_FFmpeg_Subs_H264_Fast.js',
Tags: 'pre-processing,ffmpeg,h264',
}; };
} }
function plugin(file) { function plugin(file) {
//Must return this object // Must return this object
var response = { const response = {
processFile: false, processFile: false,
preset: "", preset: '',
container: ".mp4", container: '.mp4',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: false, FFmpegMode: false,
reQueueAfter: false, reQueueAfter: false,
infoLog: "", infoLog: '',
}; };
if (file.fileMedium !== "video") { if (file.fileMedium !== 'video') {
console.log("File is not 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; response.processFile = false;
return response; return response;
} else { }
var jsonString = JSON.stringify(file); const jsonString = JSON.stringify(file);
var hasSubs = false; let hasSubs = false;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try { try {
let streamData = file.ffProbeData.streams[i]; const streamData = file.ffProbeData.streams[i];
if ( if (
streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_type.toLowerCase() === 'subtitle'
streamData.codec_name != "mov_text" && streamData.codec_name !== 'mov_text'
) { ) {
hasSubs = true; hasSubs = true;
} }
} catch (err) {} } catch (err) {
} // 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;
} }
}
/// if (file.ffProbeData.streams[0].codec_name !== 'h264') {
if (file.meta.Title != undefined) { response.infoLog += '☒File is not in h264! \n';
response.infoLog += "☒File has title metadata \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.preset = response.reQueueAfter = true;
", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.processFile = true;
response.reQueueAfter = true; response.FFmpegMode = true;
response.processFile = true; return response;
response.FFmpegMode = true; }
return response; response.infoLog += '☑File is already in h264! \n';
} else {
response.infoLog += "☑File has no title metadata \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")) { if (!jsonString.includes('aac') && hasSubs) {
response.infoLog += "☒File has no aac track \n"; response.infoLog += '☒File has no aac track and has subs \n';
response.preset = response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has aac track \n";
}
if (hasSubs) { if (file.meta.Title !== undefined && hasSubs) {
response.infoLog += "☒File has incompatible subs \n"; response.infoLog += '☒File has title and has subs \n';
response.preset = response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has no/compatible subs \n";
}
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; 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; module.exports.details = details;

@ -1,144 +1,137 @@
/* eslint-disable */
function details() { function details() {
return { return {
id: "Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow", id: 'Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow',
Stage: "Pre-processing", Stage: 'Pre-processing',
Name: "TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ", Name: 'TheRealShadoh FFmpeg Subs Slow, video MP4, audio AAC, keep subs. ',
Type: "Video", 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 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: Link:
"https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js", 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/'
Tags: "pre-processing,ffmpeg,h264", + 'Tdarr_Plugin_z2ab_TheRealShadoh_FFmpeg_Subs_H264_Slow.js',
Tags: 'pre-processing,ffmpeg,h264',
}; };
} }
function plugin(file) { function plugin(file) {
//Must return this object // Must return this object
var response = { const response = {
processFile: false, processFile: false,
preset: "", preset: '',
container: ".mp4", container: '.mp4',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: false, FFmpegMode: false,
reQueueAfter: false, reQueueAfter: false,
infoLog: "", infoLog: '',
}; };
if (file.fileMedium !== "video") { if (file.fileMedium !== 'video') {
console.log("File is not 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; response.processFile = false;
return response; return response;
} else { }
var jsonString = JSON.stringify(file); const jsonString = JSON.stringify(file);
var hasSubs = false; let hasSubs = false;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try { try {
let streamData = file.ffProbeData.streams[i]; const streamData = file.ffProbeData.streams[i];
if ( if (
streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_type.toLowerCase() === 'subtitle'
streamData.codec_name != "mov_text" && streamData.codec_name !== 'mov_text'
) { ) {
hasSubs = true; hasSubs = true;
} }
} catch (err) {} } catch (err) {
} // 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;
} }
}
/// if (file.ffProbeData.streams[0].codec_name !== 'h264') {
if (file.meta.Title != undefined) { response.infoLog += '☒File is not in h264! \n';
response.infoLog += "☒File has title metadata \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.preset = response.reQueueAfter = true;
", -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.processFile = true;
response.reQueueAfter = true; response.FFmpegMode = true;
response.processFile = true; return response;
response.FFmpegMode = true; }
return response; response.infoLog += '☑File is already in h264! \n';
} else {
response.infoLog += "☑File has no title metadata \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")) { if (!jsonString.includes('aac') && hasSubs) {
response.infoLog += "☒File has no aac track \n"; response.infoLog += '☒File has no aac track and has subs \n';
response.preset = response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has aac track \n";
}
if (hasSubs) { if (file.meta.Title !== undefined && hasSubs) {
response.infoLog += "☒File has incompatible subs \n"; response.infoLog += '☒File has title and has subs \n';
response.preset = response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has no/compatible subs \n";
}
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; 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; module.exports.details = details;

@ -1,145 +1,139 @@
/* eslint-disable */
function details() { function details() {
return { return {
id: "Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast", id: 'Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_VeryFast',
Stage: "Pre-processing", Stage: 'Pre-processing',
Name: Name:
"TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ", 'TheRealShadoh FFmpeg Subs VeryFast, video MP4, audio AAC, keep subs. ',
Type: "Video", 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 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: Link:
"https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js", 'https://github.com/TheRealShadoh/Tdarr_Plugins/blob/master/Community/'
Tags: "pre-processing,ffmpeg,h264", + 'Tdarr_Plugin_z3ab_TheRealShadoh_FFmpeg_Subs_H264_Veryfast.js',
Tags: 'pre-processing,ffmpeg,h264',
}; };
} }
function plugin(file) { function plugin(file) {
//Must return this object // Must return this object
var response = { const response = {
processFile: false, processFile: false,
preset: "", preset: '',
container: ".mp4", container: '.mp4',
handBrakeMode: false, handBrakeMode: false,
FFmpegMode: false, FFmpegMode: false,
reQueueAfter: false, reQueueAfter: false,
infoLog: "", infoLog: '',
}; };
if (file.fileMedium !== "video") { if (file.fileMedium !== 'video') {
console.log("File is not 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; response.processFile = false;
return response; return response;
} else { }
var jsonString = JSON.stringify(file); const jsonString = JSON.stringify(file);
var hasSubs = false; let hasSubs = false;
for (var i = 0; i < file.ffProbeData.streams.length; i++) { for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try { try {
let streamData = file.ffProbeData.streams[i]; const streamData = file.ffProbeData.streams[i];
if ( if (
streamData.codec_type.toLowerCase() == "subtitle" && streamData.codec_type.toLowerCase() === 'subtitle'
streamData.codec_name != "mov_text" && streamData.codec_name !== 'mov_text'
) { ) {
hasSubs = true; hasSubs = true;
} }
} catch (err) {} } catch (err) {
} // 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;
} }
}
/// if (file.ffProbeData.streams[0].codec_name !== 'h264') {
if (file.meta.Title != undefined) { response.infoLog += '☒File is not in h264! \n';
response.infoLog += "☒File has title metadata \n"; response.preset = ', -map_metadata -1 -map 0:v -map 0:s? '
response.preset = + '-map 0:a -c:v libx264 -preset veryfast -c:a aac -c:s mov_text';
", -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.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else { response.infoLog += '☑File is already in h264! \n';
response.infoLog += "☑File has no title metadata \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")) { if (!jsonString.includes('aac') && hasSubs) {
response.infoLog += "☒File has no aac track \n"; response.infoLog += '☒File has no aac track and has subs \n';
response.preset = response.preset = ', -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a aac -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has aac track \n";
}
if (hasSubs) { if (file.meta.Title !== undefined && hasSubs) {
response.infoLog += "☒File has incompatible subs \n"; response.infoLog += '☒File has title and has subs \n';
response.preset = response.preset = ', -map_metadata -1 -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text';
", -map 0:v -map 0:s? -map 0:a -c:v copy -c:a copy -c:s mov_text"; response.reQueueAfter = true;
response.reQueueAfter = true; response.processFile = true;
response.processFile = true; response.FFmpegMode = true;
response.FFmpegMode = true; return response;
return response; }
} else {
response.infoLog += "☑File has no/compatible subs \n";
}
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; 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; module.exports.details = details;

Loading…
Cancel
Save