Page 1 of 1

Suddenly lost all Season and Episode Numbers

Posted: 22 Apr 2019, 23:15
by wilfortune
I don't know when exactly this started happening, but my best guess is sometime yesterday or the day before (4/20/19-4/21/19).

Here's my expression:

Code: Select all

{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[:]/, "-")}/{episode.special ? 'Season 0' : 'Season '+s}/{n.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[:]/, "-")}.{episode.special ? '00X'+special.pad(2) : {(episode.season ? s : 1).pad(2)}+'X'+{e.pad(2)}}.{t.replaceAll(/[!?.]+$/).replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[:]/, "-").replacePart(' ($1)')}
This section here is where the error lies:

Code: Select all

{episode.special ? '00X'+special.pad(2) : {(episode.season ? s : 1).pad(2)}+'X'+{e.pad(2)}}
I created a new Preset, using one of the examples, and it worked fine. No loss of S/E numbers, so I feel confident something changed in the Expressions Engine that broke the format I'm trying to achieve (in the way I'm trying to achieve it).

Image

I'm too new to post links:
https://pastebin.com/ZFRiv5B3

I realize the expression is overblown for what it does, but I hope it isn't too difficult to discern. If there is any easier way to land at the same result, I'm all ears. As you can see from the Screenshot, I can't use it the way it is now.

I've been a huge fan of this software since converting over from "theRenamer"... So much so, that I'm not really in the habit of reviewing the potential output before hitting "Rename". I realize the preview is meant to guard against these types of mistakes, but because I wasn't paying close enough attention, I now have to find and fix all the files it incorrectly named.

Any help would be appreciated.

Re: Suddenly lost all Season and Episode Numbers

Posted: 23 Apr 2019, 00:09
by kim

Code: Select all

{episode.special ? '00X'+special.pad(2) : (episode.season ? s : 1).pad(2)+'X'+e.pad(2)}

Re: Suddenly lost all Season and Episode Numbers

Posted: 23 Apr 2019, 00:17
by wilfortune
I think that did it, thank you!

Re: Suddenly lost all Season and Episode Numbers

Posted: 23 Apr 2019, 03:53
by rednoah
1.
I recommend just using the {sxe} binding.


2.
You can use the History feature to Reverse your previous rename operation. No need to do it manually. ;)
Image

Re: Suddenly lost all Season and Episode Numbers

Posted: 24 Apr 2019, 01:59
by wilfortune
It'd be much easier to use the {sxe} binding, but I want to maintain the consistency of the naming structure that began when I was using "theRenamer".

I didn't even realize there was a "History" function! Thank you for pointing that out for me :)

As it happened, the solution (thanks again, kim!) came in quickly enough, and the software made quick work of fixing everything. Huge relief. It would've been painstaking to fix the 100+ episodes one by one.

I'm still a little curious as to why my expressions worked without issue until this week? I'd like to know so that I can make sure I'm not doing anything else that will trip the program up...

Re: Suddenly lost all Season and Episode Numbers

Posted: 24 Apr 2019, 04:20
by rednoah
The outermost {...} delimit a Groovy expression, but everything within the outermost {...} is just Groovy code. Notably, {...} is not a substitution pattern for variables. {...} in Groovy code are simply Groovy closures or code blocks, and are thus semantically completely different from the outermost {...}.


I'm not sure why it worked before. Maybe accidentally. FileBot does sometime evaluate closures to get the value, instead of just printing the closure toString() value.

Re: Suddenly lost all Season and Episode Numbers

Posted: 23 May 2019, 14:11
by wilfortune
That makes sense. Thank you!

Re: Suddenly lost all Season and Episode Numbers

Posted: 25 Jul 2019, 13:46
by jschultz0614
I've been using this:

Code: Select all

{n.replaceAll(':', '_')}/
	{episode.special ? 'Specials' : 
		'Season '+s.pad(2)}/{n.replaceAll(':', '_')} - {episode.special ? 
		'S.pad(2)xE.pad(2)'+special.pad(2) : {S.pad(2)}+'x'+{E.pad(2)}} - 
	[{absolute}] - 
	[{airdate}] - 
	{t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replaceAll(':', '_').replacePart(', Part $1')}.
	[{vc}.{hd}.{vf}.{resolution}].
	[{ac}-{channels}({af})].
	{languages}
for, well, since forever it seems and as of this week, it no longer supplies the Season and Episode Numbers as well as the absolute episode numbers on some of the episodes.

Re: Suddenly lost all Season and Episode Numbers

Posted: 25 Jul 2019, 14:31
by kim
I find it hard to believe this ever worked

Code: Select all

{episode.special ? 'S.pad(2)xE.pad(2)'+special.pad(2) : {S.pad(2)}+'x'+{E.pad(2)}}
use this

Code: Select all

{episode.special ? S.pad(2) + 'x' + special.pad(2) : S.pad(2) + 'x' + E.pad(2)}

Re: Suddenly lost all Season and Episode Numbers

Posted: 25 Jul 2019, 14:43
by jschultz0614
OK,...

I've taken out the special part and have the following:

Code: Select all

{n.replaceAll(':', '_')}/
	{S.pad(2)}x{E.pad(2)} -
	[{absolute}] - 
	[{airdate}] - 
	{t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replaceAll(':', '_').replacePart(', Part $1')}.
	[{vc}.{hd}.{vf}.{resolution}].
	[{ac}-{channels}({af})].
	{languages}
The Season and episode are back, however, all the rest of the values are not.

Re: Suddenly lost all Season and Episode Numbers

Posted: 25 Jul 2019, 16:57
by kim
I made it better ;)

Code: Select all

{n.replaceAll(':', '_')}
{'/' + any{"Season ${s.pad(2)}"}{'Specials'}}
{' / ' + n.replaceAll(':', '_')}
{' - ' + (regular ? 
	episodes.collect{ [it.season, it.episode]*.pad(2).join('x') }.join('-') : 
	episodes.collect{ ['00', it.special]*.pad(2).join('x') }.join('-'))}
{' - [' + absolute + ']'}
{' - [' + airdate + ']'}
{' - ' + t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replaceAll(':', '_').replacePart(', Part $1')}
{'.[' + (allOf{vc}{hd}{vf}{resolution}).join('.') + ']'}
{'.[' + (allOf{ac}{'-' + channels + '(' + af + ')'}).join() + ']'}
{'.' + languages}

Re: Suddenly lost all Season and Episode Numbers

Posted: 25 Jul 2019, 17:38
by jschultz0614
kim wrote: 25 Jul 2019, 16:57 I made it better ;)

Code: Select all

{n.replaceAll(':', '_')}
{'/' + any{"Season ${s.pad(2)}"}{'Specials'}}
{' / ' + n.replaceAll(':', '_')}
{' - ' + (regular ? 
	episodes.collect{ [it.season, it.episode]*.pad(2).join('x') }.join('-') : 
	episodes.collect{ ['00', it.special]*.pad(2).join('x') }.join('-'))}
{' - [' + absolute + ']'}
{' - [' + airdate + ']'}
{' - ' + t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replaceAll(':', '_').replacePart(', Part $1')}
{'.[' + (allOf{vc}{hd}{vf}{resolution}).join('.') + ']'}
{'.[' + (allOf{ac}{'-' + channels + '(' + af + ')'}).join() + ']'}
{'.' + languages}
AWESOME!!!!

Thanks dude!