mirror of
https://github.com/gabehf/Tdarr_Plugins.git
synced 2026-03-09 15:38:19 -07:00
fix loop bug
This commit is contained in:
parent
b79f45db6b
commit
98bd5a115f
1 changed files with 22 additions and 5 deletions
|
|
@ -1,4 +1,3 @@
|
|||
/* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */
|
||||
function details() {
|
||||
return {
|
||||
id: 'Tdarr_Plugin_MC93_Migz2CleanTitle',
|
||||
|
|
@ -89,12 +88,18 @@ function plugin(file, librarySettings, inputs) {
|
|||
}
|
||||
|
||||
// Go through each stream in the file.
|
||||
for (let i = 0; i < file.ffProbeData.streams.length; i++) {
|
||||
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
|
||||
// Check if stream is a video.
|
||||
if (file.ffProbeData.streams[i].codec_type.toLowerCase() === 'video') {
|
||||
try {
|
||||
// Check if stream title is not empty, if it's not empty set to "".
|
||||
if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') {
|
||||
if (
|
||||
!(
|
||||
typeof file.ffProbeData.streams[i].tags.title === 'undefined'
|
||||
|| file.ffProbeData.streams[i].tags.title === '""'
|
||||
|| file.ffProbeData.streams[i].tags.title === ''
|
||||
)
|
||||
) {
|
||||
response.infoLog += `☒Video stream title is not empty. Removing title from stream ${i} \n`;
|
||||
ffmpegCommandInsert += ` -metadata:s:v:${videoIdx} title="" `;
|
||||
convert = true;
|
||||
|
|
@ -114,7 +119,13 @@ function plugin(file, librarySettings, inputs) {
|
|||
&& inputs.clean_audio.toLowerCase() === 'true'
|
||||
) {
|
||||
try {
|
||||
if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') {
|
||||
if (
|
||||
!(
|
||||
typeof file.ffProbeData.streams[i].tags.title === 'undefined'
|
||||
|| file.ffProbeData.streams[i].tags.title === '""'
|
||||
|| file.ffProbeData.streams[i].tags.title === ''
|
||||
)
|
||||
) {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) {
|
||||
try {
|
||||
response.infoLog += `☒More then 3 full stops in audio title. Removing title from stream ${i} \n`;
|
||||
|
|
@ -151,7 +162,13 @@ function plugin(file, librarySettings, inputs) {
|
|||
&& inputs.clean_subtitles.toLowerCase() === 'true'
|
||||
) {
|
||||
try {
|
||||
if (typeof file.ffProbeData.streams[i].tags.title !== 'undefined') {
|
||||
if (
|
||||
!(
|
||||
typeof file.ffProbeData.streams[i].tags.title === 'undefined'
|
||||
|| file.ffProbeData.streams[i].tags.title === '""'
|
||||
|| file.ffProbeData.streams[i].tags.title === ''
|
||||
)
|
||||
) {
|
||||
if (file.ffProbeData.streams[i].tags.title.split('.').length - 1 > 3) {
|
||||
try {
|
||||
response.infoLog += `☒More then 3 full stops in subtitle title. Removing title from stream ${i} \n`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue