Page 1 of 1

How many episodes

Posted: 06 May 2014, 02:08
by NPHaus
I wanted to put the number of seasons and the number of episodes of the series, for example

The Wire [5 Seasons, 60 Episodes]

For the seasons already {episodelist.season.max()}, can you do the same to know how many episodes is the show?

No way to get a list of all commands that can be used in FileBot windows, and not in mediainfo, such as episode.list, episodelist.findAll, etc.. but plan for dummies :-)
Thank you very much and good work

Re: How many episodes

Posted: 06 May 2014, 04:43
by rednoah
The number of possible commands is infinite.

The special bindings for formatting are defined here:
http://sourceforge.net/p/filebot/code/H ... gBean.java

And the rest is Groovy code. For example the max() method is documented here:
http://groovy.codehaus.org/groovy-jdk/j ... #max%28%29

Though the best way is probably the read through the examples here:
http://www.filebot.net/forums/viewtopic.php?f=5&t=2


List all episodes, get season field for all episodes, get maximum value:

Code: Select all

{episodelist.season.max()}
List all episodes, count:

Code: Select all

{episodelist.size()}
List all episodes, count only episodes with episode numbers (thus excluding specials)

Code: Select all

{episodelist.count{ it.episode }}
All of this is just basic list processing in Groovy. So you just need to find a dummy guide for that. ;)

Re: How many episodes

Posted: 06 May 2014, 16:50
by NPHaus
Okay, but I've noticed a problem.
I used episodelist.season.max () to determine how many episodes has a season, but I've realized that this shows the highest number among all seasons.

What I want now:
Season 1 has 24 episodes
Season 2 has 22 episodes
Season 3 has 19 episodes

that is, a function that tell me how many episodes has this season

Re: How many episodes

Posted: 06 May 2014, 17:11
by rednoah
Same as the above, slightly modified:

Code: Select all

{episodelist.count{ it.episode && it.season == s }}

Re: How many episodes

Posted: 02 Jan 2024, 16:06
by rednoah
{episodelist} has changed slightly. The changes are primarily that {episodelist} now works exactly the same as {model}.


e.g. Number of episodes for the season at hand:

Format: Select all

{
	' [' + episodelist.count{ it.e && it.s == s }.pad(2) + ' episodes]'
}
e.g. Check if all episodes from the season at hand are currently loaded into FileBot:

Format: Select all

{
	model.episode.containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}
e.g. Check if all episodes from the season at hand are currently loaded into FileBot with support for multi-episode matches:

Format: Select all

{
	model.episodes.flatten().containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]'
}