[END] on the last episode of the season

All about user-defined episode / movie / file name format expressions
Post Reply
Ansem
Posts: 4
Joined: 31 Aug 2016, 14:39

[END] on the last episode of the season

Post by Ansem »

Hi guys, I have started to use filebot today, instead of advanced renamer.
I'm already in love with it! but I'm missing a thing: on my old program I had a script that would add [END] at the last file.
Is it possible to do something like on filebot? I want [END] on the last episode of the season, or the last file renamed (I don't rename more than one season at time usually).
I would love something like that :D
User avatar
rednoah
The Source
Posts: 23055
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [END] on the last episode of the season

Post by rednoah »

1.
I've delete the duplicate post.

2.
It's possible but the Groovy code might be a bit complicated. The {episodelist} binding should get you started. Then you just need to if your episode object is the last episode of some season.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23055
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [END] on the last episode of the season

Post by rednoah »

1.
I've delete the duplicate post.

2.
It's possible but the Groovy code might be a bit complicated. The {episodelist} binding should get you started. Then you just need to if your episode object is the last episode of some season.
:idea: Please read the FAQ and How to Request Help.
Crankrune
Posts: 21
Joined: 20 Jul 2016, 11:35

Re: [END] on the last episode of the season

Post by Crankrune »

Try this. If the last episode is a special, this won't work, but I'll keep messing with it.

Code: Select all

{episodelist.findAll{it.season == s}[-1].toString().after('x').before(' ') == e ? '[END]' : ''}
Edit: Still haven't found a workaround for the specials, but here is a shorts version of this. Not sure why I made it so complex the first time.

Code: Select all

{episodelist.findAll{it.season == s}[-1] == episode ? '[END]' : ''}
Edit 2: Figured out the special workaround, here you go.

Code: Select all

{(episodelist.findAll{it.season == s}.episode-null)[-1] == e ? '[END]' : ''}
Ansem
Posts: 4
Joined: 31 Aug 2016, 14:39

Re: [END] on the last episode of the season

Post by Ansem »

Thanks a lot :D didn't try with specials, but at least with normal series it works fine! :D
Crankrune
Posts: 21
Joined: 20 Jul 2016, 11:35

Re: [END] on the last episode of the season

Post by Crankrune »

No problem. The work around for specials is just because with the first two formats, if the last episode in a season was a special, it wouldn't work.
User avatar
rednoah
The Source
Posts: 23055
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [END] on the last episode of the season

Post by rednoah »

Good Job!

Here's how I'd solve it:

Code: Select all

{episode == episodelist.findAll{ it.season == s && !it.special}.last() ? '[END]' : null}
Pretty much the same as yours, but more readable, hopefully. :ugeek:
:idea: Please read the FAQ and How to Request Help.
Post Reply