mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 23:48:15 -07:00
Output subs file to original folder
This commit is contained in:
parent
c0106cdf7b
commit
bbf9210139
2 changed files with 27 additions and 8 deletions
|
|
@ -43,11 +43,21 @@ module.exports.plugin = function plugin(file, librarySettings, inputs, otherArgu
|
|||
lang = subStream.tags.language
|
||||
}
|
||||
|
||||
let subsFile = file.file
|
||||
subsFile = subsFile.split('.')
|
||||
subsFile[subsFile.length - 2] += `.${lang}`
|
||||
subsFile[subsFile.length - 1] = 'srt'
|
||||
subsFile = subsFile.join('.')
|
||||
const { originalLibraryFile } = otherArguments;
|
||||
|
||||
let subsFile = '';
|
||||
|
||||
// for Tdarr V2 (2.00.05+)
|
||||
if (originalLibraryFile && originalLibraryFile.file) {
|
||||
subsFile = originalLibraryFile.file;
|
||||
} else {
|
||||
// for Tdarr V1
|
||||
subsFile = file.file;
|
||||
}
|
||||
subsFile = subsFile.split('.');
|
||||
subsFile[subsFile.length - 2] += `.${lang}`;
|
||||
subsFile[subsFile.length - 1] = 'srt';
|
||||
subsFile = subsFile.join('.');
|
||||
|
||||
let index = subStream.index
|
||||
let command = `${ffmpegPath} -i "${file.file}" -map 0:${index} "${subsFile}"`
|
||||
|
|
|
|||
|
|
@ -34,9 +34,8 @@ module.exports.details = function details() {
|
|||
};
|
||||
};
|
||||
|
||||
module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||
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: true,
|
||||
preset: '',
|
||||
|
|
@ -76,7 +75,17 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
|||
title = subStream.tags.title;
|
||||
}
|
||||
|
||||
let subsFile = file.file;
|
||||
const { originalLibraryFile } = otherArguments;
|
||||
|
||||
let subsFile = '';
|
||||
|
||||
// for Tdarr V2 (2.00.05+)
|
||||
if (originalLibraryFile && originalLibraryFile.file) {
|
||||
subsFile = originalLibraryFile.file;
|
||||
} else {
|
||||
// for Tdarr V1
|
||||
subsFile = file.file;
|
||||
}
|
||||
subsFile = subsFile.split('.');
|
||||
subsFile[subsFile.length - 2] += `.${lang}`;
|
||||
subsFile[subsFile.length - 1] = 'srt';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue