HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

All about user-defined episode / movie / file name format expressions
Post Reply
xiaobaitu2005
Posts: 17
Joined: 25 Feb 2022, 13:21

HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by xiaobaitu2005 »

IF SEASON 01 HAVE 10 EPSIODES, SEASON 2 HAVE 8 EPSIODES

HOW CAN I FINISH THIS

Code: Select all

*** [S01(10),S02(8)].*
HOW CHANGE THIS

Format: Select all

{ model.s.collect{ 'S' + it.pad(2) }.joiningDistinct(',', '(', ')') }
THANK YOU
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by rednoah »

:!: The {model} binding gives you all the values for all the files currently loaded into FileBot. It conceptually does not do what you want it to do. It works with the files you have. It notably does not work with all the episodes that may exist. It could possibly work if you only process episodes once you have all episodes for all season, or if you mean to display how many episodes you have as opposed to how many episodes there are according to the episode list.


I will now assume that you mean to generate file paths based on the episode listing, and not based on the episodes that you happen to have loaded into FileBot.


e.g. Alias (2001)

Format: Select all

{ episodelist.findAll{ it.s && it.e }.groupBy{ it.s }.collect{ k, v -> 'S' + k.pad(2) + '(' + v.e.max().pad(2) + ')' } }

Code: Select all

[S01(22), S02(22), S03(22), S04(22), S05(17)]
:idea: Please read the FAQ and How to Request Help.
xiaobaitu2005
Posts: 17
Joined: 25 Feb 2022, 13:21

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by xiaobaitu2005 »

THANKS, BUT IT DO ALL SEASON, IF HAVE 5 SEANON, MY FILES ONLY HAVE SEASON 1 AND 2 , NEED [S01(22),S02(22)].

HOW DO IT ?

THANK YOU.
xiaobaitu2005
Posts: 17
Joined: 25 Feb 2022, 13:21

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by xiaobaitu2005 »

I mean to display how many episodes I have as opposed to how many episodes there are according to the episode list.
xiaobaitu2005
Posts: 17
Joined: 25 Feb 2022, 13:21

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by xiaobaitu2005 »

LIKE, I ONLY HAVE Alias (2001) SEASON 1 AND 2.
User avatar
rednoah
The Source
Posts: 23924
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by rednoah »

xiaobaitu2005 wrote: 01 Jan 2025, 14:55 I mean to display how many episodes I have as opposed to how many episodes there are according to the episode list.
I see, then {model} is indeed the way to go.

e.g.

Format: Select all

{ model.findAll{ it.s && it.e }.groupBy{ it.s }.collect{ k, v -> 'S' + k.pad(2) + '(' + v.e.max().pad(2) + ')' } }
:idea: Please read the FAQ and How to Request Help.
xiaobaitu2005
Posts: 17
Joined: 25 Feb 2022, 13:21

Re: HOW CAN I COUNT EPSIODES NUMBER WITH SEASON

Post by xiaobaitu2005 »

It works! Thank you so much.
Post Reply