mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-15 10:15:54 -07:00
Update Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js
This commit is contained in:
parent
d64adc95c6
commit
c67334ee73
1 changed files with 9 additions and 2 deletions
|
|
@ -13,7 +13,7 @@ module.exports.details = function details() {
|
||||||
+ 'other options.',
|
+ 'other options.',
|
||||||
// Created by drpeppershaker with help from reddit user /u/jakejones48, lots of
|
// Created by drpeppershaker with help from reddit user /u/jakejones48, lots of
|
||||||
// improvements made after looking at "Tdarr_Plugin_078d" by HaveAGitGat.
|
// improvements made after looking at "Tdarr_Plugin_078d" by HaveAGitGat.
|
||||||
Version: '1.00',
|
Version: '1.04',
|
||||||
Link: '',
|
Link: '',
|
||||||
Tags: 'pre-processing,subtitle only,ffmpeg,configurable',
|
Tags: 'pre-processing,subtitle only,ffmpeg,configurable',
|
||||||
Inputs: [
|
Inputs: [
|
||||||
|
|
@ -66,9 +66,14 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||||
for (let i = 0; i < subsArr.length; i += 1) {
|
for (let i = 0; i < subsArr.length; i += 1) {
|
||||||
const subStream = subsArr[i];
|
const subStream = subsArr[i];
|
||||||
let lang = '';
|
let lang = '';
|
||||||
|
let title = 'none';
|
||||||
|
|
||||||
if (subStream.tags) {
|
if (subStream.tags) {
|
||||||
lang = subStream.tags.language;
|
lang = subStream.tags.language.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (subStream.tags.title) {
|
||||||
|
title = subStream.tags.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
let subsFile = file.file;
|
let subsFile = file.file;
|
||||||
|
|
@ -80,6 +85,8 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
|
||||||
const { index } = subStream;
|
const { index } = subStream;
|
||||||
if (fs.existsSync(`${subsFile}`)) {
|
if (fs.existsSync(`${subsFile}`)) {
|
||||||
response.infoLog += `${lang}.srt already exists. Skipping!\n`;
|
response.infoLog += `${lang}.srt already exists. Skipping!\n`;
|
||||||
|
} else if (title.toLowerCase().includes('commentary') || title.toLowerCase().includes('description')) {
|
||||||
|
response.infoLog += `Stream ${i} ${lang}.srt is a ${title} track. Skipping!\n`;
|
||||||
} else {
|
} else {
|
||||||
response.infoLog += `Extracting ${lang}.srt\n`;
|
response.infoLog += `Extracting ${lang}.srt\n`;
|
||||||
command += ` -map 0:${index} "${subsFile}"`;
|
command += ` -map 0:${index} "${subsFile}"`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue