Edit Format: preserve beginning of filename

Any questions? Need some help?
Post Reply
Nitesurgeon
Posts: 3
Joined: 02 Oct 2020, 20:55

Edit Format: preserve beginning of filename

Post 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}
kim
Power User
Posts: 1027
Joined: 15 May 2014, 16:17

Re: Edit Format: preserve beginning of filename

Post by kim »

Code: Select all

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

Code: Select all

{fn.match(/\d{3}/)} {n} - {s00e00} - {t}
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Edit Format: preserve beginning of filename

Post 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}
:idea: Please read the FAQ and How to Request Help.
Nitesurgeon
Posts: 3
Joined: 02 Oct 2020, 20:55

Re: Edit Format: preserve beginning of filename

Post 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
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Edit Format: preserve beginning of filename

Post 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.
:idea: Please read the FAQ and How to Request Help.
Nitesurgeon
Posts: 3
Joined: 02 Oct 2020, 20:55

Re: Edit Format: preserve beginning of filename

Post 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
User avatar
rednoah
The Source
Posts: 19011
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Edit Format: preserve beginning of filename

Post 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/
:idea: Please read the FAQ and How to Request Help.
Post Reply