Getting infos from filenames instead of mediainfo

All about user-defined episode / movie / file name format expressions
Post Reply
Xazmah
Posts: 15
Joined: 29 May 2018, 19:12

Getting infos from filenames instead of mediainfo

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

Re: Getting infos from filenames instead of mediainfo

Post 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.+/) }
:idea: Please read the FAQ and How to Request Help.
Xazmah
Posts: 15
Joined: 29 May 2018, 19:12

Re: Getting infos from filenames instead of mediainfo

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

Re: Getting infos from filenames instead of mediainfo

Post 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
:idea: Please read the FAQ and How to Request Help.
Xazmah
Posts: 15
Joined: 29 May 2018, 19:12

Re: Getting infos from filenames instead of mediainfo

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

Re: Getting infos from filenames instead of mediainfo

Post 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/) }
)
:idea: Please read the FAQ and How to Request Help.
Xazmah
Posts: 15
Joined: 29 May 2018, 19:12

Re: Getting infos from filenames instead of mediainfo

Post 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
Post Reply