mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-14 09:45:55 -07:00
commit
a5bd5cd3b1
4 changed files with 37 additions and 10 deletions
|
|
@ -64,7 +64,7 @@ var plugin = function (args) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
|
||||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||||
var propertyToCheck = String(args.inputs.propertyToCheck).trim();
|
var propertyToCheck = String(args.inputs.propertyToCheck).trim();
|
||||||
var valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',');
|
var valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map(function (item) { return item.trim(); });
|
||||||
var condition = String(args.inputs.condition);
|
var condition = String(args.inputs.condition);
|
||||||
args.variables.ffmpegCommand.streams.forEach(function (stream) {
|
args.variables.ffmpegCommand.streams.forEach(function (stream) {
|
||||||
var _a;
|
var _a;
|
||||||
|
|
|
||||||
|
|
@ -77,12 +77,15 @@ var plugin = function (args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newContainer === 'mp4') {
|
if (newContainer === 'mp4') {
|
||||||
if ([
|
if (codecType === 'attachment'
|
||||||
'hdmv_pgs_subtitle',
|
|| [
|
||||||
'eia_608',
|
'hdmv_pgs_subtitle',
|
||||||
'timed_id3',
|
'eia_608',
|
||||||
'subrip',
|
'timed_id3',
|
||||||
].includes(codecName)) {
|
'subrip',
|
||||||
|
'ass',
|
||||||
|
'ssa',
|
||||||
|
].includes(codecName)) {
|
||||||
stream.removed = true;
|
stream.removed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +95,16 @@ var plugin = function (args) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// handle genpts if coming from odd container
|
||||||
|
var container = args.inputFileObj.container.toLowerCase();
|
||||||
|
if ([
|
||||||
|
'ts',
|
||||||
|
'avi',
|
||||||
|
'mpg',
|
||||||
|
'mpeg',
|
||||||
|
].includes(container)) {
|
||||||
|
args.variables.ffmpegCommand.overallOuputArguments.push('-fflags', '+genpts');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
outputFileObj: args.inputFileObj,
|
outputFileObj: args.inputFileObj,
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
args.inputs = lib.loadDefaultValues(args.inputs, details);
|
||||||
|
|
||||||
const propertyToCheck = String(args.inputs.propertyToCheck).trim();
|
const propertyToCheck = String(args.inputs.propertyToCheck).trim();
|
||||||
const valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',');
|
const valuesToRemove = String(args.inputs.valuesToRemove).trim().split(',').map((item) => item.trim());
|
||||||
const condition = String(args.inputs.condition);
|
const condition = String(args.inputs.condition);
|
||||||
|
|
||||||
args.variables.ffmpegCommand.streams.forEach((stream) => {
|
args.variables.ffmpegCommand.streams.forEach((stream) => {
|
||||||
|
|
@ -101,7 +101,6 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
const prop = String(target).toLowerCase();
|
const prop = String(target).toLowerCase();
|
||||||
for (let i = 0; i < valuesToRemove.length; i += 1) {
|
for (let i = 0; i < valuesToRemove.length; i += 1) {
|
||||||
const val = valuesToRemove[i].toLowerCase();
|
const val = valuesToRemove[i].toLowerCase();
|
||||||
|
|
||||||
const prefix = `Removing stream index ${stream.index} because ${propertyToCheck} of ${prop}`;
|
const prefix = `Removing stream index ${stream.index} because ${propertyToCheck} of ${prop}`;
|
||||||
if (condition === 'includes' && prop.includes(val)) {
|
if (condition === 'includes' && prop.includes(val)) {
|
||||||
args.jobLog(`${prefix} includes ${val}\n`);
|
args.jobLog(`${prefix} includes ${val}\n`);
|
||||||
|
|
|
||||||
|
|
@ -93,11 +93,14 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
|
|
||||||
if (newContainer === 'mp4') {
|
if (newContainer === 'mp4') {
|
||||||
if (
|
if (
|
||||||
[
|
codecType === 'attachment'
|
||||||
|
|| [
|
||||||
'hdmv_pgs_subtitle',
|
'hdmv_pgs_subtitle',
|
||||||
'eia_608',
|
'eia_608',
|
||||||
'timed_id3',
|
'timed_id3',
|
||||||
'subrip',
|
'subrip',
|
||||||
|
'ass',
|
||||||
|
'ssa',
|
||||||
].includes(codecName)
|
].includes(codecName)
|
||||||
) {
|
) {
|
||||||
stream.removed = true;
|
stream.removed = true;
|
||||||
|
|
@ -108,6 +111,18 @@ const plugin = (args: IpluginInputArgs): IpluginOutputArgs => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// handle genpts if coming from odd container
|
||||||
|
const container = args.inputFileObj.container.toLowerCase();
|
||||||
|
if (
|
||||||
|
[
|
||||||
|
'ts',
|
||||||
|
'avi',
|
||||||
|
'mpg',
|
||||||
|
'mpeg',
|
||||||
|
].includes(container)
|
||||||
|
) {
|
||||||
|
args.variables.ffmpegCommand.overallOuputArguments.push('-fflags', '+genpts');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue