Skip to content

Commit

Permalink
Merge branch 'HaveAGitGat:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tehniemer authored Oct 24, 2023
2 parents fbb0921 + 2e30f24 commit ffdd98c
Show file tree
Hide file tree
Showing 394 changed files with 25,895 additions and 1,573 deletions.
108 changes: 82 additions & 26 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,87 @@
{
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"airbnb-base"
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
},
"env": {
"commonjs": true,
"es6": true,
"node": true
},
"extends": [
"airbnb-base",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": [
"prefer-arrow-functions"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"project": [
"./tsconfig.eslint.json"
]
},
"rules": {
"func-style": [
"error",
"expression"
],
"prefer-arrow-functions/prefer-arrow-functions": [
"warn",
{
"classPropertiesAllowed": false,
"disallowPrototype": false,
"returnStyle": "unchanged",
"singleReturnOnly": false
}
],
"require-await":["error"],
"global-require": 0,
"no-void": 0,
"@typescript-eslint/no-floating-promises": [
"error"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2020
},
"rules": {
"global-require":0,
"class-methods-use-this": 0,
"no-case-declarations": 0,
"camelcase": 0,
"jsx-a11y/click-events-have-key-events": 0,
"no-underscore-dangle": ["error", { "allow": ["_id"] }],
"max-len": [
"error",
{
"code": 120
}
"@typescript-eslint/no-var-requires": 0,
"class-methods-use-this": 0,
"no-case-declarations": 0,
"camelcase": 0,
"jsx-a11y/click-events-have-key-events": 0,
"no-underscore-dangle": [
"error",
{
"allow": [
"_id"
]
}
],
"max-len": [
"error",
{
"code": 120
}
],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
]
}
}
5 changes: 3 additions & 2 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
os:
[
["ubuntu-20.04"],
Expand All @@ -28,7 +28,8 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm i
- run: npm i
- run: npm i -g typescript && tsc
- run: npm run checkPlugins
- run: npm run lint
- run: npm run test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@

### VS Code ###
.vscode/

/Local
/FlowPluginsTs/LocalFlowPlugins
/FlowPlugins/LocalFlowPlugins
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_add_audio_stream_codec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,10 @@ const details = () => ({
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_handbrake_basic_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ const details = () => ({
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_handbrake_ffmpeg_custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ HandBrake examples:
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_keep_one_audio_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ If no specified language track exists, the best untagged/undefined stream will b
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_re_order_all_streams_v2.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ The default order is suitable for most people.
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ const details = () => ({
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
const details = () => ({
id: 'Tdarr_Plugin_00td_action_remove_stream_by_specified_property',
Stage: 'Pre-processing',
Name: 'Remove streams by specified property',
Type: 'Video',
Operation: 'Transcode',
Description: `
This plugin removes streams based on the specified property.
`,
Version: '1.00',
Tags: 'action',
Inputs: [
{
name: 'propertyToCheck',
type: 'string',
defaultValue: '',
inputUI: {
type: 'text',
},
tooltip:
`Enter one stream property to check.
\\nExample:\\n
codec_name
`,
},
{
name: 'valuesToRemove',
type: 'string',
defaultValue: '',
inputUI: {
type: 'text',
},
tooltip:
`Enter values of the property above to remove. For example, if removing by codec_name, could enter ac3,aac:
\\nExample:\\n
ac3,aac
`,
},
],
});

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
preset: '',
container: `.${file.container}`,
handBrakeMode: false,
FFmpegMode: true,
reQueueAfter: false,
infoLog: '',
};

if (inputs.propertyToCheck.trim() === '') {
response.infoLog += 'No input propertyToCheck entered in plugin, skipping \n';
return response;
}

const propertyToCheck = inputs.propertyToCheck.trim();

if (inputs.valuesToRemove.trim() === '') {
response.infoLog += 'No input valuesToRemove entered in plugin, skipping \n';
return response;
}

const valuesToRemove = inputs.valuesToRemove.trim().split(',');

response.preset += ', -map 0 -c copy -max_muxing_queue_size 9999';

try {
let streamToRemove = false;
for (let i = 0; i < file.ffProbeData.streams.length; i += 1) {
try {
if (valuesToRemove.includes(String(file.ffProbeData.streams[i][propertyToCheck]))) {
response.preset += ` -map -0:${i} `;
response.infoLog += ` Removing stream ${i} which is has ${propertyToCheck}`
+ ` of ${file.ffProbeData.streams[i][propertyToCheck]} \n`;
streamToRemove = true;
}
} catch (err) {
response.infoLog += ` Error reading stream ${i} ${propertyToCheck} \n`;
}
}

if (streamToRemove === true) {
response.processFile = true;
response.infoLog += ' Files has streams which need to be removed, processing \n';
} else {
response.infoLog += ' Files does not have streams which need to be removed \n';
}
} catch (err) {
response.infoLog += ` Error checking streams:${err}`;
}

return response;
};

module.exports.details = details;
module.exports.plugin = plugin;
4 changes: 2 additions & 2 deletions Community/Tdarr_Plugin_00td_action_remux_container.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const details = () => ({
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ into the specified codec. Bitrate and channel count are kept the same.
],
});

// eslint-disable-next-line no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const plugin = (file, librarySettings, inputs, otherArguments) => {
const lib = require('../methods/lib')();
// eslint-disable-next-line no-unused-vars,no-param-reassign
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-param-reassign
inputs = lib.loadDefaultValues(inputs, details);
const response = {
processFile: false,
Expand Down
Loading

0 comments on commit ffdd98c

Please sign in to comment.