Put the The at the end (but before the year) and format special episodes with S00E01

All about user-defined episode / movie / file name format expressions
Post Reply
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

Morning and happy Tuesday!

To start, this is my current format:

Code: Select all

M:\TV\{n.sortName('$2, $1')} ({y})\{regular ? 'Season' + s.pad(2) : 'Specials'}\{'s'+s.pad(2)}.e{e.pad(2)}.{t}
I current would like help changing two things.
1. Doctor Who is a good example, the title when pulling from The TVDB is Doctor Who (2005), however, I specify to put the year in the format. For 99.99% of shows this is fine. Is there a way to see the year is in the title and adjust?

2. I have condition for specials, again Doctor Who is a good example they have tons. I can manually name the episode based on what TVDB has, example s00.e162.The Star Beast. Plex is able to pick this up and get metadata. Filebot, when matching with TVDB returns ".e.The Star Beast". Why is Filebot not pulling the TVBD info? Here is a link to the Doctor Who TVBD specials page https://thetvdb.com/series/doctor-who-2 ... official/0
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Help with two things

Post by esullivan »

I think I figured out the first issue, with the year.

Replacing

Code: Select all

{n.sortName('$2, $1')} ({y})
With

Code: Select all

{ny.sortName('$2, $1')}
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with two things

Post by rednoah »

1.
Putting the The at the end is troublesome if you want to put the The after the name but before the year, so I recommend simply not doing that:

Format: Select all

{ ny }
or stripping the The at the beginning and not putting it somewhere else:

Format: Select all

{ ny.sortName() }
:idea: Adding a , The between the name and the year is of course possible, but will require some coding expertise. Do you really want "Doctor, The (2005)" anyway?




2.
Conceptually, specials only have a special number, no season number, no episode number, hence undefined values. The "S00E01" bit is made up by the {s00e00} binding which you should be using since {s00e00} will take care of special episodes, multi-episodes, etc:

Format: Select all

{ s00e00 }.{t}
If you must have lower-case letters:

Format: Select all

{ s00e00.lower() }.{t}
:idea: Alternatively, can write custom code with {s}, {e}, {es}, {special}, {episodes}, etc to transform Episode information into the file paths you want.
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Help with two things

Post by esullivan »

Thanks Red. I had figured the first part out and it's what you said. For the second part, I am using TVMaze and it has a season and episode as far as I can tell, it's listed as "S00E162" unless the backend data that is actually pulled does not reflect that?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

FileBot normalizes backend data into a uniform model that works the same regardless of selected database. I don't remember how TVMaze in particular models things. Conceptually, a special episode could belong to a specific season, Doctor Who is a good example here, but TVMaze probably does not support that in their model.


Screenshot
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

Looks like it pulled the 162 "episode" number. Is that usable in any way in my current format?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

The {special} special number is available for special episodes. The {e} episode number is available for regular episodes. {s} season number may be available for either special or regular episodes depending on the database and available information, but notably either >=1 or undefined never 0.
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

Is there a good way for the format to know? An "if" statement? I can look it up in the docs, if you can do an if. Thanks
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

Please use {s00e00} because {s00e00} takes care of everything:

Format: Select all

{ s00e00 }.{t}
If you must have lower-case letters:

Format: Select all

{ s00e00.lower() }.{t}
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

So instead of:

Code: Select all

{'s'+s.pad(2)}.e{e.pad(2)}.{t}
I would use:

Code: Select all

{s00.e00}.{t}
Is that right?
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

No, s00e00 is a variable name, like s or e or t or x. You cannot have a . dot between S00E00 without making things a lot more complicated, a lot alot more complicated if you want to implemented everything {s00e00} does implicitly.


You could be nifty and do something like this though:

Format: Select all

{ s00e00.replace('E', '.E') }
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

If I hear you right, specials are likely best to handle manually? That's fine if so. Thanks!!
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

esullivan wrote: 19 Dec 2023, 17:36 If I hear you right, specials are likely best to handle manually? That's fine if so. Thanks!!
No, what makes you think that? You just need to use the format I have given you and let it generate the file paths you want, i.e. s01e01 pattern, s00 for specials, . dot between SxE numbers, lower-case, etc:

Format: Select all

{ s00e00.replace('E', '.E').lower() }.{t}
e.g. output for regular episodes:

Code: Select all

s01.e01.Rose
e.g. output for special episodes:

Code: Select all

s00.e162.The Star Beast
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

I will play around with that. Thanks for the tip!
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

rednoah wrote: 19 Dec 2023, 16:55 Putting the The at the end is troublesome if you want to put the The after the name but before the year, so I recommend simply not doing that:

Format: Select all

{ ny }
or stripping the The at the beginning and not putting it somewhere else:

Format: Select all

{ ny.sortName() }
:idea: Adding a , The between the name and the year is of course possible, but will require some coding expertise. Do you really want "Doctor, The (2005)" anyway?
"Doctor, The (2005)" is possible, but significantly more complex. If I give you code that you cannot understand, then that could be a problem later. Personally, I'd recommend not putting the ", The" between name and the year, more easy more pretty. The problem has definitely been asked and solved before, but it might be difficult to find in the large swaths of forum posts.
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

rednoah wrote: 20 Dec 2023, 15:46
rednoah wrote: 19 Dec 2023, 16:55 Putting the The at the end is troublesome if you want to put the The after the name but before the year, so I recommend simply not doing that:

Format: Select all

{ ny }
or stripping the The at the beginning and not putting it somewhere else:

Format: Select all

{ ny.sortName() }
:idea: Adding a , The between the name and the year is of course possible, but will require some coding expertise. Do you really want "Doctor, The (2005)" anyway?
"Doctor, The (2005)" is possible, but significantly more complex. If I give you code that you cannot understand, then that could be a problem later. Personally, I'd recommend not putting the ", The" between name and the year, more easy more pretty.
I will play with that. Thanks!!
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

You can probably do something like this, i.e. remove any trailing (...) at the end of the String value if any:

Format: Select all

{ n.replaceTrailingBrackets().sortName('$2, $1') } ({y})
** Note that this code will also remove the (US) in Coupling (US)
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

rednoah wrote: 20 Dec 2023, 15:57 You can probably do something like this, i.e. remove any trailing (...) at the end of the String value if any:

Format: Select all

{ n.replaceTrailingBrackets().sortName('$2, $1') } ({y})
** Note that this code will also remove the (US) in Coupling (US)
Thanks. I think I might just stick with stripping the "the\an\a". Might be the most simple approach.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

If you're organizing files for Kodi / Plex / etc then I would strongly recommend not adding ", The" between name and year as that will almost certainly make file names not machine-readable.
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

rednoah wrote: 20 Dec 2023, 16:00 If you're organizing files for Kodi / Plex / etc then I would strongly recommend not adding ", The" between name and year as that will almost certainly make file names not machine-readable.
Yeah it is for Plex. I was assuming that it would cause issues, hence reaching out.
User avatar
rednoah
The Source
Posts: 23002
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by rednoah »

Almost certainly. Removing the "The" is already problematic, but adding at the end just makes things not match the database.

If you modify the name by removing the "The" at the beginning then you definitely want to add {tvdb-12345} ID tags so that Plex can use the numeric ID instead of the partial series name.
:idea: Please read the FAQ and How to Request Help.
User avatar
esullivan
Posts: 48
Joined: 13 Jun 2014, 16:05

Re: Put the The at the end (but before the year) and format special episodes with S00E01

Post by esullivan »

rednoah wrote: 20 Dec 2023, 16:57 Almost certainly. Removing the "The" is already problematic, but adding at the end just makes things not match the database.

If you modify the name by removing the "The" at the beginning then you definitely want to add {tvdb-12345} ID tags so that Plex can use the numeric ID instead of the partial series name.
Thanks for the help!
Post Reply