Page 1 of 1

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

Posted: 19 Dec 2023, 14:11
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

Re: Help with two things

Posted: 19 Dec 2023, 14:59
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')}

Re: Help with two things

Posted: 19 Dec 2023, 16:55
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.

Re: Help with two things

Posted: 19 Dec 2023, 17:09
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?

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

Posted: 19 Dec 2023, 17:15
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

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

Posted: 19 Dec 2023, 17:21
by esullivan
Looks like it pulled the 162 "episode" number. Is that usable in any way in my current format?

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

Posted: 19 Dec 2023, 17:22
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.

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

Posted: 19 Dec 2023, 17:24
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

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

Posted: 19 Dec 2023, 17:25
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}

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

Posted: 19 Dec 2023, 17:27
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?

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

Posted: 19 Dec 2023, 17:32
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') }

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

Posted: 19 Dec 2023, 17:36
by esullivan
If I hear you right, specials are likely best to handle manually? That's fine if so. Thanks!!

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

Posted: 19 Dec 2023, 17:48
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

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

Posted: 19 Dec 2023, 17:53
by esullivan
I will play around with that. Thanks for the tip!

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

Posted: 20 Dec 2023, 15:46
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.

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

Posted: 20 Dec 2023, 15:49
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!!

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

Posted: 20 Dec 2023, 15:57
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)

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

Posted: 20 Dec 2023, 15:59
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.

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

Posted: 20 Dec 2023, 16:00
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.

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

Posted: 20 Dec 2023, 16:02
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.

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

Posted: 20 Dec 2023, 16:57
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.

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

Posted: 20 Dec 2023, 17:08
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!