Page 1 of 1

[END] on the last episode of the season

Posted: 31 Aug 2016, 14:44
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

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

Posted: 02 Sep 2016, 03:01
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.

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

Posted: 02 Sep 2016, 03:01
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.

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

Posted: 02 Sep 2016, 20:40
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]' : ''}

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

Posted: 02 Sep 2016, 22:46
by Ansem
Thanks a lot :D didn't try with specials, but at least with normal series it works fine! :D

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

Posted: 03 Sep 2016, 01:33
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.

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

Posted: 03 Sep 2016, 04:10
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: