Can I rename without matching?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
vman
Posts: 4
Joined: 16 Dec 2019, 13:11

Can I rename without matching?

Post by vman »

I have a matching problem that I "think" can be fixed if I first improve the name of the file (produced automatically by my DVR in a format I can not change).

Here is my existing format:

Code: Select all

NBC Nightly News (1970) - 2019-12-12 06 00 00 - 12-13-2019.ts
The date at the end of the filename is accurate (12-13-2019) but the first date is not (2019-12-12).

Filebot uses that first date to do the matching, but since it is the wrong date, filebot matches the wrong episode.

Is there a way to automatically rename this file as follows:

Code: Select all

NBC Nightly News (1970) - 12-13-2019.ts
If I do this manually, Filebot then does it's magic and all is well.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can I rename without matching?

Post by rednoah »

FileBot does take all dates into consideration, but I suppose if there's a new episode every single day, then things get a bit too ambiguous.

You can use FileBot for generic renaming & pre-processing file names:
viewtopic.php?t=2072


e.g. match the last 12-13-2019 pattern and then re-arrange the numbers to 2019-12-13

Code: Select all

(fn =~ /(\d{2}).(\d{2}).(\d{4})/)[-1][3, 1, 2].join('-')

e.g. as complete generic file format, this should do, get the part before the dash, i.e. the series name, and then add the nicely formatted date:

Code: Select all

{fn.before('-')} - {(fn =~ /(\d{2}).(\d{2}).(\d{4})/)[-1][3, 1, 2].join('-')}
:idea: Please read the FAQ and How to Request Help.
vman
Posts: 4
Joined: 16 Dec 2019, 13:11

Re: Can I rename without matching?

Post by vman »

Super helpful and worked perfectly with CLI also:

Code: Select all

filebot -rename -non-strict * --format "{fn.before('-')} - {(fn =~ /(\d{2}).(\d{2}).(\d{4})/)[-1][3, 1, 2].join('-')}"
Any thoughts/resources on filtering out the already-renamed files? If I run that cli on files that have already been processed once they go from:

Code: Select all

NBC Nightly News (1970) - 2019-12-13.ts
to

Code: Select all

NBC Nightly News (1970) - .ts
This will become an issue when I automate the script.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can I rename without matching?

Post by rednoah »

The 06 00 00 bit seems to be quite unique, so we can use --file-filter to only include files that have that one:

Code: Select all

--file-filter "fn =~ /00.00/"
:idea: Please read the FAQ and How to Request Help.
vman
Posts: 4
Joined: 16 Dec 2019, 13:11

Re: Can I rename without matching?

Post by vman »

TY So much!
vman
Posts: 4
Joined: 16 Dec 2019, 13:11

Re: Can I rename without matching?

Post by vman »

I just looked at today's recording and the filename is exactly the same as on Friday. As such, I need to add today's date to the filename. Is this possible? {ny} and other "y"s are related to the movie/series data it seems.
User avatar
rednoah
The Source
Posts: 22986
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Can I rename without matching?

Post by rednoah »

e.g.

Code: Select all

{new Date().format('yyyy-MM-dd')}
:idea: Please read the FAQ and How to Request Help.
Post Reply