Merge pull request #2 from drpeppershaker/drpeppershaker-patch-1

Update Tdarr_Plugin_rr01_drpeppershaker_extract_subs_to_SRT.js
make-only-subtitle-default
drpeppershaker 5 years ago committed by GitHub
commit 70419a1d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,7 +13,7 @@ module.exports.details = function details() {
+ 'other options.',
// Created by drpeppershaker with help from reddit user /u/jakejones48, lots of
// improvements made after looking at "Tdarr_Plugin_078d" by HaveAGitGat.
Version: '1.00',
Version: '1.04',
Link: '',
Tags: 'pre-processing,subtitle only,ffmpeg,configurable',
Inputs: [
@ -66,11 +66,16 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
for (let i = 0; i < subsArr.length; i += 1) {
const subStream = subsArr[i];
let lang = '';
let title = 'none';
if (subStream.tags) {
lang = subStream.tags.language;
}
if (subStream.tags.title) {
title = subStream.tags.title;
}
let subsFile = file.file;
subsFile = subsFile.split('.');
subsFile[subsFile.length - 2] += `.${lang}`;
@ -80,6 +85,8 @@ module.exports.plugin = function plugin(file, librarySettings, inputs) {
const { index } = subStream;
if (fs.existsSync(`${subsFile}`)) {
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 {
response.infoLog += `Extracting ${lang}.srt\n`;
command += ` -map 0:${index} "${subsFile}"`;

Loading…
Cancel
Save