How to detect if a TV-show or anime serie has any special episode?

All about user-defined episode / movie format expressions
Post Reply
asaren
Posts: 2
Joined: 21 Jul 2019, 07:21

How to detect if a TV-show or anime serie has any special episode?

Post by asaren » 21 Jul 2019, 07:59

I am trying to write a naming scheme that can create "Season" or "Specials" subfolders only if an anime or tv-show serie has more than one season or has special episode, but cannot find a way to detect it.

The progrss so far, I can only know to detect if a serie has more than one season or not by the following code.

Code: Select all

{ny}/{if(episodelist.season.max() > 1) " ${episode.special ? 'Specials' : 'Season '+s} (${episodelist.findAll{ it.season == s }.airdate.year.min()})/";} {n} - {s00e00} - {t}
The results I'd like to make are:
(1) if an anime or tv-show has only one season and has no special episode:
After War Gundam X (1996)/After War Gundam X - S01E01 - title
(2) if an anime or tv-show has only one season and has no special episode:
Gurren Lagann (2007)/Season 1 (2007)/Gurren Lagann - S01E01 - title
Gurren Lagann (2007)/Specials (2007)/Gurren Lagann - S00E01 - title

I have searched the way to do it but couldn't found.
Thank you very much for your help

User avatar
rednoah
The Source
Posts: 16433
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How to detect if a TV-show or anime serie has any special episode?

Post by rednoah » 21 Jul 2019, 09:12

:!: Note that AniDB Anime only ever have exactly 1 season, i.e. AniDB Anime don't have the concept of a season at all, only normal episode and special episode.


Check if series has at least one episode where season number is 2 or higher:

Code: Select all

episodelist.any{ it.season > 1 }
Check if there is any special episode:

Code: Select all

episodelist.any{ it.special }
Check if either of these conditions holds true:

Code: Select all

episodelist.any{ it.season > 1 } || episodelist.any{ it.special }

PS: You might also be interested in the {sy} season years binding, e.g. {sy.min()}
:idea: Please read the FAQ and How to Request Help.

asaren
Posts: 2
Joined: 21 Jul 2019, 07:21

Re: How to detect if a TV-show or anime serie has any special episode?

Post by asaren » 21 Jul 2019, 13:08

Thank you very much. It's working.

Post Reply