#1 2022-07-29 14:35

loungebob
Member
Registered: 2015-09-29
Posts: 33

Distilling 100s of rules into a few concise ones...

so after years of usage, I've accumulated hundreds of rules that have gotten difficult to maintain.

lately I thought about it and figured this should actually be kind of easy and be doable with a few rules actually. at least in my mind.

I rename shows and movies.

they start with the movie name or show name, then year for movies and season/episode numbering for shows. then followed by a bunch of meta data then dash and release group name and then the file format. the subexpressions are separated by dots.

in my head, I can tell ReNamer to look at everything after S0?E?? and before .mkv and then just re-arrange the data to my liking.

like: SHOWNAME.S01E01.NF.1080p.WEB-DL.DDP5.1.HDR.x264-RG becomes: SHOWNAME.S01E01.1080p.NF.WEB-DL.HDR.DDP5.1.x264-RG

I already have manual rules to catch the above for most circumstances and dozens of regex rules to do the same. but is there a way to tell ReNamer to assign a value to each of the meta data (like one for WEB-DL, HDR, HLG, x264 etc) and then re-arrange them in a specified way in just a couple of rules? also, ignore if certain values are not present/found?

rearrange sounded like the function I wanted but I've never really gotten it to work over the years.

so I use rules like these
288) Replace: Replace all ".HDR.1080p.WEBRip.x265-" with ".1080p.NF.WEBRip.10bit.HDR.DDP5.1.x265-" (skip extension)
350) Replace: Replace using wildcards ".HMAX.WEB-DL.*.H.*-" with ".HMAX.WEBRip.$1.x$2-" (skip extension)
364) Replace: Replace using wildcards "S0?E??.*.1080p" with "S0$1E$2$3.1080p" (skip extension)
365) Replace: Replace using wildcards "S0?e??.*.2160p" with "S0$1E$2$3.2160p" (skip extension)

it seems unnecessarily complex but this seems how my brain is wired lol.

I appreciate any input how to clean this all up.

Offline

#2 2022-07-30 14:52

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,211

Re: Distilling 100s of rules into a few concise ones...

It might be very difficult, if even possible at all, to replace your hundreds of specialised rules with just a few generic rules, if there are many variations in tokens, their count and their order. It may turn out that using Pascal Script is the only way to do it.

So maybe we'll start with your first example and then we'll see what comes next.

First, let's break down your example filename into numbered tokens and rearrange them into a new sequence:

SHOWNAME.S01E01.NF.1080p.WEB-DL.DDP5.1.HDR.x264-RG
1        2      3  4     5      6    7 8   9
SHOWNAME.S01E01.1080p.NF.WEB-DL.HDR.DDP5.1.x264-RG
1        2      4     3  5      8   6    7 9

The corresponding Rearrange rule (use without quotes):

> Split by delimiters: "."
> New pattern: "$1.$2.$4.$3.$5.$8.$6.$7.$9"
> Skip extension: yes

This will work for filenames with the same number of tokens and arranged in the same order.

Offline

#3 2022-07-30 15:10

loungebob
Member
Registered: 2015-09-29
Posts: 33

Re: Distilling 100s of rules into a few concise ones...

hi den, I think the above is what I did and got after all those years but then decided to not pursue it any further since this is only useful if those °%*&ç groups would follow a proper pattern.

if I dont misunderstand the above, this only works if e.g. NF would always be before the resolution data and not just anywhere in-between season/episode number and file ending, right?

but that is exactly what would make my loads of rules obsolete if ReNamer would look at every instance between the above mentioned anchors and keep e.g. NF no matter where it is position-wise and then put it where I tell it to order-wise.

so basically, RN would still assign a value to NF but I would not need to know it, I would just tell it to place NF now between 1080p and WEB-DL.

oh I think I'm explaining that very confusingly lol.

there is basically a list of let's say 50 words (DSNP, NF, HMAX, HULU....DDP, DD, FLAC, AAC....WEB-DL, WEBRip, BCORE, BluRay.....1080p, 1080i, 2160p....x264, x265, h.264, hevc.....and so on) that can appear between season/episode numbers and between -GROUP/.file
I was wondering if I can define that list somewhere, ReNamer would look at everything, I assume then assigns a token to each value and then re-orders them in the way I define (by using value names from the list, not tokens, since I would not know the token because of the changing order).
also, the above rearrange rule would mostly not work because of changing number of tokens.

Offline

Board footer

Powered by FluxBB