Skip to content

Conversation

@kalbasit
Copy link
Contributor

@kalbasit kalbasit commented Oct 5, 2025

A plugin to do simple arithmetic to a user variable.

@HaveAGitGat
Copy link
Owner

I've updated this so we can use it on any variable on the args object.

Using const inputsOriginal = args.thisPlugin.inputsDB; we can get the input from before the variable templating is applied, so can have the original string e.g. {{{args.path.to.variable}}} and can then use that when updating the variable.

@kalbasit
Copy link
Contributor Author

@HaveAGitGat Thank you for improving my code, appreciate it.

I tested this and it works, can you merge it if you're also satisfied with it?

@HaveAGitGat HaveAGitGat merged commit e74653b into HaveAGitGat:master Oct 15, 2025
6 checks passed
@kalbasit kalbasit deleted the arithmetic-flow-variable branch October 15, 2025 13:29
@digitalassassins
Copy link
Contributor

I have already done literally the same thing about 6 months ago, the code is almost identical 😂Great minds code alike.. You are more than welcome to port over the other plugins for this repository into the main plugins channel, as some of them are essential for doing more advanced loops, and with them, I found, you can literally achieve anything:
https://github.com/digitalassassins/TdarrMathsPlugins

GreaterLessThan - If variable is greater or less than
OddEven - If it's odd or even
MathFormula - run a mathematical formula on a variable
VariableMath - run basic arithmetic on a variable

ListJoin - Compile a list
ListLoop - Loop through a List
ListSplit - Split a list

They allow you to do for each and also run maths calculations on filters..

I managed to create a loop where the flow encoded a 2-second snippet of video,
Ran back through the loop, took a screenshot of what the filter looked like on the encoded video, then added maths to a video filter until it hit the limit for that filter.. which then broke out and then started adding to the next filter, then looped back around..
It created screenshots for every setting for the sharpening filter, the denoising filter and the deblocking filter.
The settings for each filter were then saved as the screenshot name so I could find the perfect settings for each video automatically.
All I needed to do, if the video required denoising and sharpening, was add "_DENOISE" to the end of the video files I wanted to denoise. It jumped into the loop automatically, creating screenshots alongside the movie.. Then I could set the filter values I preferred at the end and get the perfect output automatically.. Something impossible to do without all the advanced loops and mathematical plugins.

@kalbasit
Copy link
Contributor Author

@digitalassassins oh that's cool! Do you mind adding them to this repo? @HaveAGitGat has been great at accepting/improving my submissions and they automatically help everyone using flows; I wish I had found your repo as opposed to have coded this myself from scratch.

@digitalassassins
Copy link
Contributor

@kalbasit Yeah i updated the HDR flow plugin to include Dolby Vision detection and @HaveAGitGat was very helpful. I just coded them in JS for quickness so i could hit the ground running.. I'm extremely busy with work at the moment, but soon as I get a few minuites to spare I'll modify the code to TypeScript and submit them into the repository, that is if @HaveAGitGat thinks they would be suitible to be included as Standard with the community plugins ?

I was trying to write a userguide on how to use the flow plugins to achieve different things, Hopefully i could get that finished so it could be included in the official documentation, so its not to taxing on the brain trying to work out what they are for.

Screenshot 2025-10-21 063312

Ive created examples like above, that one is to work out how long a video is and take snapshots at certain intervals through the video using calculations and the loops, aswell as creating a list.

So it works out how many screenshots you want, gets the length of the video, works out what the times would be, then uses a loop to move ffmpeg to each specific time in the array and take a screenshot..

Useful to create preview screenshots for each video you encode, so you dont have to lauch each video to view the quality, you can just encode the video then get Tdarr to enter that loop at the end and boom.. you have a screenshots folder filled with the number of screenshots you want. Tdarr can then end the flow and move on to the next video..

These are just some of the advanced stuff you can do with loops, array lists and mathematics plugins 😁

bigibas123 added a commit to bigibas123/Tdarr_Plugins that referenced this pull request Nov 7, 2025
* upstream/master:
  docs: add more info to relative path tooltip (HaveAGitGat#884)
  feat(flows): add calculateFileHash plugin (HaveAGitGat#878)
  feat(flows): add arithmeticFlowVariable plugin (HaveAGitGat#871)
  chore: skip file access checks on unmapped node (HaveAGitGat#877)
  chore: add codeEditor inputUI type (HaveAGitGat#875)
  chore: add apiKey to header if available (HaveAGitGat#874)
  chore: add x-api-key to header (HaveAGitGat#873)
  fix: Tdarr_Plugin_NIfPZuCLU_2_Pass_Loudnorm_Audio_Normalisation keep all streams from original (HaveAGitGat#872)
  Fix Tdarr_Plugin_078d to support MPEG-4 Timed Text (MP4TT / tx3g) subtitles (HaveAGitGat#842)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants