mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 10:15:54 -07:00
tidy
This commit is contained in:
parent
d28272f6d4
commit
9c8ac98728
60 changed files with 5481 additions and 5980 deletions
|
|
@ -1,8 +1,4 @@
|
|||
|
||||
|
||||
|
||||
function details() {
|
||||
|
||||
return {
|
||||
id: "Tdarr_Plugin_sdd3_Remove_Commentary_Tracks",
|
||||
Stage: "Pre-processing",
|
||||
|
|
@ -11,90 +7,76 @@ function details() {
|
|||
Operation: "Remux",
|
||||
Description: `[Contains built-in filter] If commentary tracks are detected, they will be removed. \n\n`,
|
||||
Version: "1.00",
|
||||
Link: "https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js",
|
||||
Tags:'pre-processing,ffmpeg,audio only',
|
||||
}
|
||||
|
||||
Link:
|
||||
"https://github.com/HaveAGitGat/Tdarr_Plugins/blob/master/Community/Tdarr_Plugin_sdd3_Remove_Commentary_Tracks.js",
|
||||
Tags: "pre-processing,ffmpeg,audio only",
|
||||
};
|
||||
}
|
||||
|
||||
function plugin(file) {
|
||||
|
||||
|
||||
//Must return this object
|
||||
|
||||
var response = {
|
||||
|
||||
processFile: false,
|
||||
preset: '',
|
||||
container: '.mp4',
|
||||
preset: "",
|
||||
container: ".mp4",
|
||||
handBrakeMode: false,
|
||||
FFmpegMode: false,
|
||||
reQueueAfter: false,
|
||||
infoLog: '',
|
||||
|
||||
}
|
||||
infoLog: "",
|
||||
};
|
||||
|
||||
if (file.fileMedium !== "video") {
|
||||
response.processFile = false
|
||||
response.infoLog += "☒File is not a video! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☒File is not a video! \n";
|
||||
return response;
|
||||
} else {
|
||||
response.infoLog += "☑File is a video! \n"
|
||||
response.infoLog += "☑File is a video! \n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
var audioIdx = -1
|
||||
var hasCommentaryTrack = false
|
||||
var ffmpegCommandInsert = ""
|
||||
|
||||
var audioIdx = -1;
|
||||
var hasCommentaryTrack = false;
|
||||
var ffmpegCommandInsert = "";
|
||||
|
||||
for (var i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
|
||||
//keep track of audio streams for when removing commentary track
|
||||
try {
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio") {
|
||||
audioIdx++
|
||||
audioIdx++;
|
||||
}
|
||||
} catch (err) { }
|
||||
|
||||
} catch (err) {}
|
||||
|
||||
//check if commentary track and passing audio stream number
|
||||
try {
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" && file.ffProbeData.streams[i].tags.title.toLowerCase().includes("commentary")) {
|
||||
|
||||
|
||||
ffmpegCommandInsert += ` -map -0:a:${audioIdx}`
|
||||
hasCommentaryTrack = true
|
||||
|
||||
if (
|
||||
file.ffProbeData.streams[i].codec_type.toLowerCase() == "audio" &&
|
||||
file.ffProbeData.streams[i].tags.title
|
||||
.toLowerCase()
|
||||
.includes("commentary")
|
||||
) {
|
||||
ffmpegCommandInsert += ` -map -0:a:${audioIdx}`;
|
||||
hasCommentaryTrack = true;
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
if (hasCommentaryTrack === true) {
|
||||
|
||||
response.processFile = true;
|
||||
response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy`
|
||||
response.container = '.' + file.container
|
||||
response.handBrakeMode = false
|
||||
response.FFmpegMode = true
|
||||
response.preset = `, -map 0 ${ffmpegCommandInsert} -c copy`;
|
||||
response.container = "." + file.container;
|
||||
response.handBrakeMode = false;
|
||||
response.FFmpegMode = true;
|
||||
response.reQueueAfter = true;
|
||||
response.infoLog += "☒File contains commentary tracks. Removing! \n"
|
||||
return response
|
||||
|
||||
response.infoLog += "☒File contains commentary tracks. Removing! \n";
|
||||
return response;
|
||||
} else {
|
||||
|
||||
response.infoLog += "☑File doesn't contain commentary tracks! \n"
|
||||
|
||||
response.infoLog += "☑File doesn't contain commentary tracks! \n";
|
||||
}
|
||||
|
||||
response.processFile = false
|
||||
response.infoLog += "☑File meets conditions! \n"
|
||||
return response
|
||||
response.processFile = false;
|
||||
response.infoLog += "☑File meets conditions! \n";
|
||||
return response;
|
||||
}
|
||||
|
||||
module.exports.details = details;
|
||||
module.exports.plugin = plugin;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue