Keeping tags from release name

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Zebbe152
Posts: 12
Joined: 18 Mar 2015, 09:06

Keeping tags from release name

Post by Zebbe152 »

I want to keep some of the tags from the release name, such as PROPER, REPACK, REAL etc.

I've been using {'.'+fn.match(/REAL/).upper()} in my script and it's been working great. However, yesterday I ran into a problem with the show UnREAL.

The original title: UnREAL.S03E01.720p.HDTV.x264-BATV

The result was: UnREAL.S03E01.REAL.720p

As you can see filebot added the REAL tag at the end because of the title of the show. It there any way to prevent this from happening? I really want to be able to keep the REAL tags in the filename if it's possible.
User avatar
rednoah
The Source
Posts: 22995
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Keeping tags from release name

Post by rednoah »

1.
You could match the . before and after. It won't work for all possible corner cases, but it's easy and it'll work for your specific example:

Code: Select all

fn.match(/[.]REAL[.]/)

2.
You could also match REAL only when it precedes 720p|1080p|etc but unfortunately there's no easy magic solution that works for all corner cases.


3.
In the case of episode files, only matching REAL after some 01 double digit patterns might be a surprisingly good solution:

Code: Select all

fn.after(/\d\d/).match(/REAL/)
:idea: Please read the FAQ and How to Request Help.
Zebbe152
Posts: 12
Joined: 18 Mar 2015, 09:06

Re: Keeping tags from release name

Post by Zebbe152 »

Thank you!

Option 1 is probably the best solution in my case. I tried something similar yesterday but I got the formatting wrong... :)
Post Reply