Put S00 files into Specials folder

All about user-defined episode / movie / file name format expressions
Post Reply
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

Put S00 files into Specials folder

Post by ChefGregS »

I am sure there is some simple Boolean logic to do this but I am apparently not hitting it right. Here is what I have:

Code: Select all

M:/TV Series/{n.upperInitial().colon(' -').replace('?', '!') }/{'Season '+s} {sy}/{n.upperInitial().colon(' -').replace('?', '!') } - {s00e00} - [{airdate}] - {t.colon(" - ").replace('?', '!') }
This takes me from:
Z:\Shows\Emergency\Emergency! 101.avi

to:

M:\TV Series\Emergency!\Season 1 [1972]\Emergency! - S01E01 - [1972-01-22] - Mascot.avi
This is exactly what I want. However, I have 5 extra files that do get named correctly with the season being 00. "Emergency! - S00E01 - Season 2 Gag Reel"

This file just ends up in the M:\TV Series\Emergency!\ folder.

What I want is it to be put into a Extras folder. Thus, the logic would have to state that IF the season "s" =00 THEN add Extras else skip it.

It would go here:

M:/TV Series/{n.upperInitial().colon(' -').replace('?', '!') }/ if s=00 then Extras Folder else {'Season '+s} {sy}/{n.upperInitial().colon(' -').replace('?', '!') } - {s00e00} - [{airdate}] - {t.colon(" - ").replace('?', '!') }

Once upon a time when I did coding for a living I was really good at this stuff (back in the 80's) but it's been 30 years since I did that stuff... And I have not bothered to learn THIS coding style much more than what I have already done. I have seen some insane HUGE algorithms for naming files so I am sure this can be done. Can someone help me? Thanks.

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

Re: Put S00 files into Specials folder

Post by rednoah »

{s} is undefined for specials (i.e. it's not 0) and thus it will throw an exception:
viewtopic.php?f=5&t=1895

e.g. you can use the any function for this kinda of use case:

Code: Select all

{ any{"Season $s $sy"}{'Specials'} }
:idea: Please read the FAQ and How to Request Help.
ChefGregS
Posts: 99
Joined: 30 Mar 2016, 11:14

Re: Put S00 files into Specials folder

Post by ChefGregS »

Once again, thank you!!! Worked like a charm. And as I look at it, makes perfect sense. :)

Greg
Post Reply