Suddenly lost all Season and Episode Numbers

All about user-defined episode / movie / file name format expressions
Post Reply
wilfortune
Posts: 4
Joined: 22 Apr 2019, 22:36

Suddenly lost all Season and Episode Numbers

Post 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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Suddenly lost all Season and Episode Numbers

Post by kim »

Code: Select all

{episode.special ? '00X'+special.pad(2) : (episode.season ? s : 1).pad(2)+'X'+e.pad(2)}
wilfortune
Posts: 4
Joined: 22 Apr 2019, 22:36

Re: Suddenly lost all Season and Episode Numbers

Post by wilfortune »

I think that did it, thank you!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Suddenly lost all Season and Episode Numbers

Post 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
:idea: Please read the FAQ and How to Request Help.
wilfortune
Posts: 4
Joined: 22 Apr 2019, 22:36

Re: Suddenly lost all Season and Episode Numbers

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

Re: Suddenly lost all Season and Episode Numbers

Post 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.
:idea: Please read the FAQ and How to Request Help.
wilfortune
Posts: 4
Joined: 22 Apr 2019, 22:36

Re: Suddenly lost all Season and Episode Numbers

Post by wilfortune »

That makes sense. Thank you!
jschultz0614
Posts: 3
Joined: 05 Jun 2019, 04:59

Re: Suddenly lost all Season and Episode Numbers

Post 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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Suddenly lost all Season and Episode Numbers

Post 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)}
jschultz0614
Posts: 3
Joined: 05 Jun 2019, 04:59

Re: Suddenly lost all Season and Episode Numbers

Post 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.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Suddenly lost all Season and Episode Numbers

Post 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}
jschultz0614
Posts: 3
Joined: 05 Jun 2019, 04:59

Re: Suddenly lost all Season and Episode Numbers

Post 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!
Post Reply