Using {s.pad(2)} does not yield results when s=0

All about user-defined episode / movie / file name format expressions
Post Reply
the1337moderate
Posts: 11
Joined: 11 Jan 2020, 14:24

Using {s.pad(2)} does not yield results when s=0

Post by the1337moderate »

As a continuation to this previous thread. Using the code block {s.pad(2)} doesn't seem to work if the season value is 0. Using FileBot 4.8.5

Example

Code: Select all

D:\TV Shows\{n} ({y})/Season {s.pad(2)}/{n} ({y}) - {s00e00} - {t}
will give this output:

Code: Select all

D:\TV Shows\30 Rock (2005)\Season \30 Rock (2005) - S00E03 - Live from Studio 6H (West Coast).mkv
Last edited by the1337moderate on 11 Jan 2020, 14:47, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Using {s.pad(2)} does not yield results when s=0

Post by rednoah »

{s} is never 0. You are probably referring to specials. Please check the Plex naming scheme example on how to do conditional formatting to get specials into Season 00 folders.
:idea: Please read the FAQ and How to Request Help.
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Using {s.pad(2)} does not yield results when s=0

Post by kim »

Television Specials

Shows sometimes air “specials” or other content that isn’t part of the standard season. “Specials” episodes are always part of season zero (i.e. season number “00”) and should be placed inside a folder named either Season 00 or Specials.

/TV Shows/ShowName/Specials/ShowName – s00e13 – Optional_Info.ext

Where you specify the correct episode numbers. If you’re unsure whether a particular episode is a Special or not, check the episode on TheTVDB and name it as you see it there.

If an “episode” you have doesn’t appear in TheTVDB (e.g. DVD Specials or goof reel), place this content in the Season 00 or Specials folder named using s00eYY using a false “YY” number (e.g.: Heroes s00e99). The show will be available to play in a Plex App but won’t have any special metadata gathered, such as a summary.
https://support.plex.tv/articles/naming ... how-files/
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: Using {s.pad(2)} does not yield results when s=0

Post by kim »

This is what you want:

Code: Select all

{'/'+any{"Season ${s.pad(2)}"}{'Season 00'}}

Code: Select all

{ny}{'/'+any{"Season ${s.pad(2)}"}{'Season 00'}}{'/'+ny}{' - '+s00e00}{' - '+t}
or if multi episode

Code: Select all

{ny}{'/'+any{"Season ${s.pad(2)}"}{'Season 00'}}{'/'+ny}{' - '+(regular ? episodes.collect{ 'S'+[it.season, it.episode]*.pad(2).join('E') }.join('-') : episodes.collect{ ['S00', it.special]*.pad(2).join('E') }.join('-'))}{' - '+t}
output:
30 Rock (2005)/Season 00/30 Rock (2005) - S00E03 - Live from Studio 6H (West Coast)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Using {s.pad(2)} does not yield results when s=0

Post by rednoah »

e.g. here's an example from the {plex} format page:

Code: Select all

{n}/{episode.special ? 'Specials' : 'Season '+s.pad(2)}/{n} - {episode.special ? 'S00E'+special.pad(2) : s00e00} - {t}
:idea: viewtopic.php?t=4116

:arrow: Just replace 'Specials' with 'Season 00' and you're good.
:idea: Please read the FAQ and How to Request Help.
Post Reply