Skip to content

Commit

Permalink
Trying to improve linting
Browse files Browse the repository at this point in the history
  • Loading branch information
aunefyren committed Oct 4, 2023
1 parent d9d9d70 commit 7f6f210
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const details = () => ({
type: 'text',
},
tooltip:
`Enter values of the stream codec type to process. Nothing/empty input means all types of streams will be inspected for processing. For example, if removing by codec_name on video streams, enter video:
`Enter values of the stream codec type to process. Nothing/empty input means all types of streams will be inspected for processing.

Check failure on line 21 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

This line has a length of 139. Maximum allowed is 120
For example, if removing by codec_name on video streams, enter video:
\\nExample:\\n
video,subtitle,audio
Expand Down Expand Up @@ -60,12 +61,13 @@ const details = () => ({
type: 'text',
},
tooltip:
`Enter one or more properties to check for its existance. If the property is missing or null, the stream will be removed. Useful for fixing corrupt streams. For example, if codec_name is missing, the stream will be removed:
`Enter one or more properties to check for its existance. If the property is missing or null, the stream will be removed.

Check failure on line 64 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

This line has a length of 129. Maximum allowed is 120
Useful for fixing corrupt streams. For example, if codec_name is missing, the stream will be removed:
\\nExample:\\n
codec_name
`,
}
},
],
});

Expand Down Expand Up @@ -112,29 +114,27 @@ const plugin = (file, librarySettings, inputs, otherArguments) => {
let streamToRemove = false;
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try {

// Skip if the codec_type is filtered out
if(codecTypeFilter.length != 0 && !codecTypeFilter.includes(String(file.ffProbeData.streams[i]["codec_type"]))) {
if(codecTypeFilter.length != 0 && !codecTypeFilter.includes(String(file.ffProbeData.streams[i]['codec_type']))) {

Check failure on line 118 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

This line has a length of 121. Maximum allowed is 120

Check failure on line 118 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

Expected space(s) after "if"

Check failure on line 118 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

Expected '!==' and instead saw '!='

Check failure on line 118 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

["codec_type"] is better written in dot notation
continue;

Check failure on line 119 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

Unexpected use of continue statement
}

// Check if chosen non-empty properties are empty
// If they are empty, set emptyValue to true
var emptyValue = false;
let emptyValue = false;
for (let j = 0; j < removeIfPropertyMissing.length; j += 1) {
response.infoLog += `DEBUG: stream ${i} property for ${removeIfPropertyMissing[j]}
is ${file.ffProbeData.streams[i][removeIfPropertyMissing[j]]} \n`;

response.infoLog += `DEBUG: stream ${i} property for ${removeIfPropertyMissing[j]} is ${file.ffProbeData.streams[i][removeIfPropertyMissing[j]]} \n`;

if(file.ffProbeData.streams[i][removeIfPropertyMissing[j]] == 'undefined' || file.ffProbeData.streams[i][removeIfPropertyMissing[j]] == null) {
if (file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === 'undefined' || file.ffProbeData.streams[i][removeIfPropertyMissing[j]] === null) {

Check failure on line 129 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

This line has a length of 156. Maximum allowed is 120
emptyValue = true;
response.infoLog += ` Removing stream ${i} which is has ${removeIfPropertyMissing[j]} missing`
response.infoLog += ` Removing stream ${i} which is has ${removeIfPropertyMissing[j]} missing`;
break

Check failure on line 132 in Community/Tdarr_Plugin_00td_action_remove_stream_by_specified_property.js

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-20.04)

Missing semicolon
}
}

// If the value to remove is present OR an empty value is found, remove the stream
if ((valuesToRemove.includes(String(file.ffProbeData.streams[i][propertyToCheck]))) || emptyValue) {

// Add to preset
response.preset += ` -map -0:${i} `;

Expand Down

0 comments on commit 7f6f210

Please sign in to comment.