|
|
|
@ -1,5 +1,4 @@
|
|
|
|
/* eslint-disable */
|
|
|
|
/* eslint-disable */
|
|
|
|
// tdarrSkipTest
|
|
|
|
|
|
|
|
const details = () => {
|
|
|
|
const details = () => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
id: "Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4",
|
|
|
|
id: "Tdarr_Plugin_da11_Dallas_FFmpeg_Presets_H264_MP4",
|
|
|
|
@ -63,6 +62,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
const lib = require('../methods/lib')();
|
|
|
|
const lib = require('../methods/lib')();
|
|
|
|
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
|
|
|
// eslint-disable-next-line no-unused-vars,no-param-reassign
|
|
|
|
inputs = lib.loadDefaultValues(inputs, details);
|
|
|
|
inputs = lib.loadDefaultValues(inputs, details);
|
|
|
|
|
|
|
|
|
|
|
|
var response = {
|
|
|
|
var response = {
|
|
|
|
processFile: false,
|
|
|
|
processFile: false,
|
|
|
|
preset: "",
|
|
|
|
preset: "",
|
|
|
|
@ -71,15 +71,17 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
FFmpegMode: false,
|
|
|
|
FFmpegMode: false,
|
|
|
|
reQueueAfter: false,
|
|
|
|
reQueueAfter: false,
|
|
|
|
infoLog: "",
|
|
|
|
infoLog: "",
|
|
|
|
addInfo(status, info) {
|
|
|
|
|
|
|
|
this.infoLog += (status ? "☑" : "☒") + " " + info + "\n";
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const addInfo = (status, info) => {
|
|
|
|
|
|
|
|
response.infoLog += (status ? "☑" : "☒") + " " + info + "\n";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Check the file is a video
|
|
|
|
// Check the file is a video
|
|
|
|
if (file.fileMedium !== "video") {
|
|
|
|
if (file.fileMedium !== "video") {
|
|
|
|
console.log("File is not video");
|
|
|
|
console.log("File is not video");
|
|
|
|
response.addInfo(BAD, `File is not video`);
|
|
|
|
addInfo(BAD, `File is not video`);
|
|
|
|
response.processFile = false;
|
|
|
|
response.processFile = false;
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -88,7 +90,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
let preset = getPreset(inputs.FFmpeg_preset);
|
|
|
|
let preset = getPreset(inputs.FFmpeg_preset);
|
|
|
|
|
|
|
|
|
|
|
|
if (preset === null) {
|
|
|
|
if (preset === null) {
|
|
|
|
response.addInfo(
|
|
|
|
addInfo(
|
|
|
|
BAD,
|
|
|
|
BAD,
|
|
|
|
`Invalid Preset, \"${inputs.FFmpeg_preset}\" please select from (slow,medium,fast,veryfast)`
|
|
|
|
`Invalid Preset, \"${inputs.FFmpeg_preset}\" please select from (slow,medium,fast,veryfast)`
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -126,10 +128,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hasBadSubs)
|
|
|
|
if (hasBadSubs)
|
|
|
|
response.addInfo(BAD, "File contains unsupported sub(s), dropping these!");
|
|
|
|
addInfo(BAD, "File contains unsupported sub(s), dropping these!");
|
|
|
|
|
|
|
|
|
|
|
|
if (file.ffProbeData.streams[0].codec_name != "h264") {
|
|
|
|
if (file.ffProbeData.streams[0].codec_name != "h264") {
|
|
|
|
response.addInfo(BAD, "File is not in h264!");
|
|
|
|
addInfo(BAD, "File is not in h264!");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map_metadata -1 -map 0:V " +
|
|
|
|
", -map_metadata -1 -map 0:V " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -140,11 +142,11 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.addInfo(GOOD, "File is already in h264!");
|
|
|
|
addInfo(GOOD, "File is already in h264!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (file.meta.Title != undefined && !jsonString.includes("aac") && hasSubs) {
|
|
|
|
if (file.meta.Title != undefined && !jsonString.includes("aac") && hasSubs) {
|
|
|
|
response.addInfo(BAD, "File has title metadata and no aac and subs");
|
|
|
|
addInfo(BAD, "File has title metadata and no aac and subs");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -157,7 +159,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!jsonString.includes("aac") && hasSubs) {
|
|
|
|
if (!jsonString.includes("aac") && hasSubs) {
|
|
|
|
response.addInfo(BAD, "File has no aac track and has subs");
|
|
|
|
addInfo(BAD, "File has no aac track and has subs");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map 0:v " +
|
|
|
|
", -map 0:v " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -170,7 +172,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (file.meta.Title != undefined && hasSubs) {
|
|
|
|
if (file.meta.Title != undefined && hasSubs) {
|
|
|
|
response.addInfo(BAD, "File has title and has subs");
|
|
|
|
addInfo(BAD, "File has title and has subs");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -183,7 +185,7 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (file.meta.Title != undefined) {
|
|
|
|
if (file.meta.Title != undefined) {
|
|
|
|
response.addInfo(BAD, "File has title metadata");
|
|
|
|
addInfo(BAD, "File has title metadata");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
", -map_metadata -1 -map 0:v " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -194,11 +196,11 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.addInfo(GOOD, "File has no title metadata");
|
|
|
|
addInfo(GOOD, "File has no title metadata");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!jsonString.includes("aac")) {
|
|
|
|
if (!jsonString.includes("aac")) {
|
|
|
|
response.addInfo(BAD, "File has no aac track");
|
|
|
|
addInfo(BAD, "File has no aac track");
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map 0:v " +
|
|
|
|
", -map 0:v " +
|
|
|
|
subMap +
|
|
|
|
subMap +
|
|
|
|
@ -209,14 +211,14 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.addInfo(GOOD, "File has aac track");
|
|
|
|
addInfo(GOOD, "File has aac track");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hasSubs) {
|
|
|
|
if (hasSubs) {
|
|
|
|
if (hasBadSubs) {
|
|
|
|
if (hasBadSubs) {
|
|
|
|
response.addInfo(BAD, "File has incompatible subs, dropping these...");
|
|
|
|
addInfo(BAD, "File has incompatible subs, dropping these...");
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.addInfo(BAD, "File has compatible subs, copying...");
|
|
|
|
addInfo(BAD, "File has compatible subs, copying...");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
response.preset =
|
|
|
|
response.preset =
|
|
|
|
", -map 0:v " + subMap + " -map 0:a -c:v copy -c:a copy " + subType;
|
|
|
|
", -map 0:v " + subMap + " -map 0:a -c:v copy -c:a copy " + subType;
|
|
|
|
@ -224,10 +226,10 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
response.FFmpegMode = true;
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
response.addInfo(GOOD, "File has no/compatible subs");
|
|
|
|
addInfo(GOOD, "File has no/compatible subs");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
response.addInfo(GOOD, "File meets conditions!");
|
|
|
|
addInfo(GOOD, "File meets conditions!");
|
|
|
|
return response;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|