Page 1 of 1

How to customize format? 01x01 vs 1x01

Posted: 20 Apr 2012, 22:51
by JazJon
Hello, How can I customize the format output to add the zero before the season number?

For example, I'd like season 01 episode 01 to be named. TV Show name - 01x01 - Episode name
not 1x11

I tried to look over the wiki but I'm not quite following.
http://filebot.sourceforge.net/naming.html

FileBot rocks so far, love it by the way.

Re: How to customize format? 01x01 vs 1x01

Posted: 21 Apr 2012, 03:44
by rednoah
Check the examples again. I format episode number to two-digit all the time.

Like this:

Code: Select all

{s.pad(2)+'x'}{e.pad(2)}
Note: This expression doesn't work for multi-episodes, but shows the point.

Re: How to customize format? 01x01 vs 1x01

Posted: 21 Apr 2012, 04:39
by JazJon
rednoah wrote:Check the examples again. I format episode number to two-digit all the time.

Like this:
{s.pad(2)+'x'}{e.pad(2)}
Thanks, so the full line I need is: {n} - {s.pad(2)+'x'}{e.pad(2)}- {t}

I think the confusion is because the default syntax used is not shown to me. When you bring up Episode Format, the line is empty/blank so I had no example to go off of. (you're left starting from scratch) :)

Your partial example was enough to figure out the rest thanks.
rednoah wrote:Note: This expression doesn't work for multi-episodes, but shows the point.
I'll be sure to manually rename the multi-episodes that are combined into one giant file.

Re: How to customize format? 01x01 vs 1x01

Posted: 21 Apr 2012, 04:41
by JazJon
Oh... also, will the extra zero pad only be applied to single digits I hope? 1 will be 01 but 11 won't be 011 right?

Re: How to customize format? 01x01 vs 1x01

Posted: 21 Apr 2012, 04:59
by rednoah
Yep, .pad(n) pads to a n-digit string.

You can handle multi episodes via {episodes} binding. E.g.

Code: Select all

{s.pad(2)+'x'}{episodes*.episode*.pad(2).join("-")}

Re: How to customize format? 01x01 vs 1x01

Posted: 22 Nov 2014, 11:50
by redgee34
I'd like season 01 episode 01 to be named. TV Show name - 01x01 - Episode name
not 1x11


You can easily check out our best quality 200-101 exam - braindumps exam dumps prepare you well

Re: How to customize format? 01x01 vs 1x01

Posted: 28 Nov 2014, 18:45
by MC Lamer
redgee34 wrote:I'd like season 01 episode 01 to be named. TV Show name - 01x01 - Episode name
not 1x11

Code: Select all

{n} - {s.pad(2)+'x'}{e.pad(2)} - {t}

Code: Select all

{n} - {s.pad(2)+'x'}{episodes*.episode*.pad(2).join("-")} - {t}
These expressions should both do what you're looking for, redgee.

Re: How to customize format? 01x01 vs 1x01

Posted: 22 Feb 2016, 22:26
by hshah
I am using this in Filebot on my Synology but for some reason it is skipping the season folder inside the episode folder:

Code: Select all

{n}/{'\''Season '\''+s}/{n} - {s.pad(2)+'x'}{episodes*.episode*.pad(2).join("-")} - {t}
This bit is in there so I have no idea why it is doing that:

Code: Select all

{'\''Season '\''+s}

Code: Select all

[MOVE] Rename [/volume1/EpisodesTEMP/The Simpsons - 27x14 - Gal of Constant Sorrow.mp4] to [/volume1/Episodes/The Simpsons/The Simpsons - 27x14 - Gal of Constant Sorrow.mp4]

Re: How to customize format? 01x01 vs 1x01

Posted: 23 Feb 2016, 06:52
by rednoah
Because you're trying to access a variable called Season, which doesn't exist, so the {expression} fails.

e.g.

Code: Select all

{n}/{'Season '+s}/{n} - {s.pad(2)}x{es*.pad(2).join('-')} - {t}
I recommend using {sxe} or {s00e00} instead. If you have triple episodes, Plex will want 1x01-03 and won't understand 1x01-02-03 so you might want to do this:

Code: Select all

{n}/{'Season '+s}/{n} - {sxe.split('x')*.pad(2).join('x')} - {t}

Re: How to customize format? 01x01 vs 1x01

Posted: 24 Feb 2016, 23:14
by hshah
rednoah wrote:Because you're trying to access a variable called Season, which doesn't exist, so the {expression} fails.

e.g.

Code: Select all

{n}/{'Season '+s}/{n} - {s.pad(2)}x{es*.pad(2).join('-')} - {t}
I recommend using {sxe} or {s00e00} instead. If you have triple episodes, Plex will want 1x01-03 and won't understand 1x01-02-03 so you might want to do this:

Code: Select all

{n}/{'Season '+s}/{n} - {sxe.split('x')*.pad(2).join('x')} - {t}
I think I was being silly because this is working now:

Code: Select all

{n}/Season {s.pad(2)}/{n} - {s.pad(2)+'x'}{episodes*.episode*.pad(2).join("-")} - {t}

Re: How to customize format? 01x01 vs 1x01

Posted: 25 Feb 2016, 03:12
by rednoah
You probably just messed up the argument passing. Use an @file instead:
viewtopic.php?f=3&t=3244

Re: How to customize format? 01x01 vs 1x01

Posted: 04 Apr 2020, 21:42
by nartana
I'm using GUI via OSX (all latest).

I'd like {mbps} to appear with two digits on the left side of the decimal point.

e.g. "/EpisodeTitle [06.2 mbps].mkv"

I've tried the following:

Code: Select all

{'/' + t}{' ' + mbps.pad(3)}

Code: Select all

{'/' + t}{' ' + mbps.pad(4)}

Code: Select all

{'/' + t}{' ' + mbps.pad 2}
All of which produce "6.2 mbps" (rather than "06.2 mbps").

Is {string.pad()} uniquely incapable of defining format for {mbps}?

Thank you.

Re: How to customize format? 01x01 vs 1x01

Posted: 04 Apr 2020, 22:39
by kim

Code: Select all

{media.OverallBitRate.toBigDecimal().div(1000000).round(1).pad(4) + ' Mbps'}

Code: Select all

{'6.2'.toBigDecimal().pad(4) + ' Mbps'}

Code: Select all

{mbps.pad(9)}

Re: How to customize format? 01x01 vs 1x01

Posted: 05 Apr 2020, 01:43
by nartana
Oh, ok — string.pad() applies to the total number of characters, not just numbers.

Your solutions each worked 100% for me. I think I even understand why.

Thank, Kim.

Re: How to customize format? 01x01 vs 1x01

Posted: 05 Apr 2020, 06:49
by rednoah
Yes, {mbps} will give you a pre-formatted String value, not a numeric value.

Alternatively, {bitrate} will give you the numeric value in bps that you can then round and format yourself to your preferences.

Re: How to customize format? 01x01 vs 1x01

Posted: 06 Apr 2020, 02:56
by kim
bonus info

Code: Select all

{ String a = '6.2'; a.padLeft(4,'0') + ' *** ' + a.padRight(4,'0') + ' *** ' + a.center(5, '0') }
06.2 *** 6.20 *** 06.20

Re: How to customize format? 01x01 vs 1x01

Posted: 06 Apr 2020, 08:05
by rednoah
Oh! Even String.format() padding counts based on the String length:

Code: Select all

{String.format('%05.1f', bitrate / 1e6)}

Code: Select all

045.1

Re: How to customize format? 01x01 vs 1x01

Posted: 09 Apr 2020, 21:15
by nartana
Belated thank-you for this addt'l info re. {mbps} parameters. Looking forward to trying it out.

Although I'm more of an 'abstract' thinker (artist) I really appreciate the precision and "absoluteness" of the coding, expressions, etc. And, in that light, I sincerely appreciate your willingness to consider my questions, which haven't always complied with (clearly stated) requested formatting for posts. I'm increasingly able to answer my own questions without posting, because of the input and advice you (@rednoah and @kim) have provided.

<tl;dr> *cheers*