How many episodes

All about user-defined episode / movie / file name format expressions
Post Reply
NPHaus
Posts: 14
Joined: 12 Sep 2013, 23:32

How many episodes

Post 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
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How many episodes

Post 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. ;)
:idea: Please read the FAQ and How to Request Help.
NPHaus
Posts: 14
Joined: 12 Sep 2013, 23:32

Re: How many episodes

Post 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
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How many episodes

Post by rednoah »

Same as the above, slightly modified:

Code: Select all

{episodelist.count{ it.episode && it.season == s }}
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How many episodes

Post 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]'
}
:idea: Please read the FAQ and How to Request Help.
Post Reply