Page 1 of 1

Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 09:32
by Xazmah
Hi,

So I want to rename some files in a mounted Google Drive without many API calls and the slow process

But I want FileBot to guess things like {vf}, {source}, {aco}, {channels}, {ac}, {group} from filename instead of mediainfo, is it possible?

Example of filename: Mare.of.Easttown.S01E01.Miss.Lady.Hawk.Herself.1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES (most infos are already there in the filename)

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 10:33
by rednoah
You can use match() to match arbitrary patterns from the file name.


e.g. match 720p / 1080p / etc patterns from the current file name: 1080p

Code: Select all

{ fn.match(/[0-9]{3,4}p/) }

e.g. match an entire section of the current file name: 1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES

Code: Select all

{ fn.match(/[0-9]{3,4}p.+/) }

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 11:05
by Xazmah
rednoah wrote: 07 Jun 2021, 10:33 You can use match() to match arbitrary patterns from the file name.


e.g. match 720p / 1080p / etc patterns from the current file name: 1080p

Code: Select all

{ fn.match(/[0-9]{3,4}p/) }

e.g. match an entire section of the current file name: 1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES

Code: Select all

{ fn.match(/[0-9]{3,4}p.+/) }
For subtitles ending with .eng using (/[0-9]{3,4}p.+/) keep the .eng like (1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES.eng) anyway to remove the .eng part?

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 11:19
by rednoah
Xazmah wrote: 07 Jun 2021, 11:05 For subtitles ending with .eng using (/[0-9]{3,4}p.+/) keep the .eng like (1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES.eng) anyway to remove the .eng part?
Here's how it works:
https://regexr.com/5v0oe

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 11:32
by Xazmah
rednoah wrote: 07 Jun 2021, 11:19
Xazmah wrote: 07 Jun 2021, 11:05 For subtitles ending with .eng using (/[0-9]{3,4}p.+/) keep the .eng like (1080p.AMZN.WEB-DL.DDP5.1.H.264-TEPES.eng) anyway to remove the .eng part?
Here's how it works:
https://regexr.com/5v0oe
Thanks it worked!

In case of anime, like [Erai-raws] Shingeki no Kyojin - The Final Season - 01 [1080p][Multiple Subtitle]

What if I want to put (Erai-raws 1080p) at the end?

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 11:39
by rednoah
Xazmah wrote: 07 Jun 2021, 11:32 What if I want to put (Erai-raws 1080p) at the end?
You can match different patterns at different times in your format.

e.g.

Code: Select all

{ plex.name }
(
{ fn.match(/^\[(.*?)\]/) }
 
{ fn.match(/[0-9]{3,4}p/) }
)

Re: Getting infos from filenames instead of mediainfo

Posted: 07 Jun 2021, 11:45
by Xazmah
rednoah wrote: 07 Jun 2021, 11:39
Xazmah wrote: 07 Jun 2021, 11:32 What if I want to put (Erai-raws 1080p) at the end?
You can match different patterns at different times in your format.

e.g.

Code: Select all

{ plex.name }
(
{ fn.match(/^\[(.*?)\]/) }
 
{ fn.match(/[0-9]{3,4}p/) }
)
This one worked too, I'll start testing with regexr to figure out matching for different kind of releases, thanks