Page 1 of 1

Edit Format: preserve beginning of filename

Posted: 02 Oct 2020, 21:05
by Nitesurgeon
Hey there, love this software. I have some episode titles that are in this format:

031 Star Wars The Clone Wars - S02E19

The number at the beginning signifies the chronological order this episode takes place, since the series as a whole is not in chronological order. I want to rename them with filebot so I get all the episode titles, but preserve the chronology numbers at the beginning, like so:

031 Star Wars The Clone Wars - S02E19 - The Zillo Beast Strikes Back

What is the easiest way to do this by editing the format? My format is like this right now: {n} - {s00e00} - {t}

Re: Edit Format: preserve beginning of filename

Posted: 02 Oct 2020, 21:39
by kim

Code: Select all

{absolute.pad(3)} {n} - {s00e00} - {t}

Code: Select all

{fn.match(/\d{3}/)} {n} - {s00e00} - {t}

Re: Edit Format: preserve beginning of filename

Posted: 03 Oct 2020, 03:19
by rednoah
{airdate} might also work well since we're talking about chronological order, assuming that episodes were aired in chronological order:

Code: Select all

[{airdate}] {n} - {s00e00} - {t}

Re: Edit Format: preserve beginning of filename

Posted: 03 Oct 2020, 04:41
by Nitesurgeon
They were not aired chronologically. It was only after they all aired in season order that they released a chronological viewing order for the whole series. I will try those suggestions and see what happens

Re: Edit Format: preserve beginning of filename

Posted: 03 Oct 2020, 06:04
by rednoah
In this case, the fn.match() approach recommended by kim will work best, i.e. just copy over the number from the source file path into the destination file path. Alternatively, the {i} binding (i.e. item row index as seen in the UI) might work as well, but only if you process files sequence by sequence.

Re: Edit Format: preserve beginning of filename

Posted: 05 Oct 2020, 19:11
by Nitesurgeon
Awesome, the fn.match() works perfectly. The {i} binding works as well if I am doing all of the episodes at once. What do the "/\" symbols mean in the fn.match though? I can't seem to parse out their purpose

Re: Edit Format: preserve beginning of filename

Posted: 06 Oct 2020, 03:59
by rednoah
The /.../ slashy string literal makes writing regular expressions easier:
https://groovy-lang.org/syntax.html#_slashy_string

\ is part of the regular expression, e.g. used for character classes:
https://regexr.com/