Page 1 of 1

Need Help With File Selector Expression Code

Posted: 16 Mar 2022, 08:24
by aaronth07
What I want to do:

[*]Import only MKV, MP4, and SRT files

[*]Import only files that don't include "sample" or "trailer" in the filename.

[*]Import only files that aren't in a separate folder names "Featurettes", "Extras", or "Specials".

[*]Import only files with a runtime of more than 60 minutes.

[*]Import only files that are not in the SxE format.

[*]Import only files that are not in absolute numbering format.

[*]After import and rename, move files to a newly created folder with the same name as the files, in a specific path (F:\Movies & TV\Movies).

Here's the script I have:

File selector expression:

Code: Select all

only{ ext =~ /mp4|mkv/ }{ fn.match(/sample|trailer/) } minutes > 60 && !file.isEpisode()
Format expression:

Code: Select all

{movie}/{movie}
Obviously the file selector expression does not include everything I want it to do, nor is it in correct format. I just mixed and match code from other posts. I have no idea what the syntax for the file selector expression is, nor how to write the correct syntax for my purposes. Unfortunately, I also could not find a complete list of syntax or expressions anywhere, so i'm posting here for help with this.

My end goal is to have 3 presets, all doing the same thing, but one for movies (this one), one for TV, and one for anime.

If anyone could help me with this, or give me tips/guidance on the syntax, I would be grateful, thanks.

Re: Need Help With File Selector Expression Code

Posted: 17 Mar 2022, 06:19
by rednoah
The complete list of possible expressions is infinite, so that you can do anything. If you're already familiar with format expressions, then filter expressions will be easier. You will also need basic Groovy coding skills, i.e. how to use Logical operators. You'll want to prototype your filter expression in the Format Editor, so that you can see the true or false value that your code yields for a given file.


e.g. filter expression

Code: Select all

ext =~ /mkv|mp4|srt/ && !(fn =~ /sample|trailer/) && !(folder =~ /Featurettes|Extras|Extras/) && minutes >= 60 && !(fn =~ /\d{1,2}x\d{2}/) && !(fn =~ /\d{3}/)

e.g. format expression

Code: Select all

F:/Movies & TV/{plex}