Page 1 of 1

Comparison between series total episodes and season episodes

Posted: 24 Sep 2023, 22:41
by lemon389
Hello,

I kindly request your support for the following situation I'm facing with FileBot.

Goal: To write the absolute number in an anime series only when required.

Scenario:
I have the total amount of episodes for the series with: {episodelist.size()}
I have the total amount of episodes for the actual season with: {episodelist.findAll{ s == it.s }.e.max()}
Expectation: Compare above data, if the count of episodes it's the same for both, then, absolute numbers are not required, otherwise, I will write absolute numbers.

Problem:
The following sentence is always true, despite the series, I changed the comparison from "!=" to ">" and then I receive an error.
I believe that the root cause is that one (or both?) values are not integer, therefore, they can not be compared, but I was not able to force them as integer to be able to perform such comparison.

Can you please support me?

Groovy: Select all

{{episodelist.size()} != {episodelist.findAll{ s == it.s }.e.max()} ? {absolute} : null}
Error:

Code: Select all

"Expression yields empty value: Cannot compare __script_411ad9ab5f5328afaefd0ef0b7d3ccfb_85$_run_closure1 with value '__script_411ad9ab5f5328afaefd0ef0b7d3ccfb_85$_run_closure1@310986dc' and __script_411ad9ab5f5328afaefd0ef0b7d3ccfb_85$_run_closure2 with value '__script_411ad9ab5f5328afaefd0ef0b7d3ccfb_85$_run_closure2@5898f42e'"

Re: Comparison between series total episodes and season episodes

Posted: 25 Sep 2023, 06:25
by rednoah
e.g.

Format: Select all

{ episodelist.size() != episodelist.findAll{ s == it.s }.e.max() ? absolute : null }
:arrow: :arrow: Learn how {expressions} work and useful Helper Functions



e.g. maybe you could just do "add absolute numbers to shows that have more than one season" though:

Format: Select all

{ sc > 1 ? absolute : null }

Re: Comparison between series total episodes and season episodes

Posted: 27 Sep 2023, 03:32
by lemon389
I was overcomplicating things... thanks for your support!