Conditionally Using --q Option

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
HarryMuscle
Posts: 34
Joined: 06 Jan 2022, 22:40

Conditionally Using --q Option

Post by HarryMuscle »

I run a scheduled script that invokes FileBot and the AMC script to process new downloads and since I don't always get perfect matches (especially for TV shows) I'm thinking of making use of the --q option to specify a movie or series ID if that information is present in the folder that is being processed (the idea being that I will try to add the ID to the folder name when possible). However, I have a few questions.

I assume if I use something like:

Code: Select all

--q "{ folder.name.match(/ID([0-9]{5,11})/) }"
then things would work correctly even with multiple movie folders ... correct?

What I can't figure out though is what if one of the movies doesn't contain an ID, is there some way to fall back to whatever the original query would have been and not override it for that movie?

Thanks,
Harry
Last edited by HarryMuscle on 02 Feb 2022, 04:15, edited 2 times in total.
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Conditionally using --q Option

Post by rednoah »

The shell script that calls filebot with or without --q depending on the situation would have to take care of that.


:idea: You could --file-filter to select only file paths where the folder contains the ID ensuring that --q always works for the selected files:

Code: Select all

--file-filter "folder.name.match(/ID([0-9]{5,11})/)" --q "{ folder.name.match(/ID([0-9]{5,11})/) }"
:arrow: viewtopic.php?t=4222
:idea: Please read the FAQ and How to Request Help.
HarryMuscle
Posts: 34
Joined: 06 Jan 2022, 22:40

Re: Conditionally using --q Option

Post by HarryMuscle »

rednoah wrote: 02 Feb 2022, 03:59 The shell script that calls filebot with or without --q depending on the situation would have to take care of that.


:idea: You could --file-filter to select only file paths where the folder contains the ID ensuring that --q always works for the selected files:

Code: Select all

--file-filter "folder.name.match(/ID([0-9]{5,11})/)" --q "{ folder.name.match(/ID([0-9]{5,11})/) }"
:arrow: viewtopic.php?t=4222
Interesting solution. Curious though, what would be the default query used by FileBot when the --q option isn't specified? Is it just the folder name? Or is there a whole bunch of logic involved to create the default query?

Thanks,
Harry
User avatar
rednoah
The Source
Posts: 22998
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Conditionally Using --q Option

Post by rednoah »

If you don't specify --q then the underlying code is completely different. There is indeed a whole bunch of logic involved to conjure up and select the query candidates, so there's no simple answer there.



EDIT:


On second thought... What happens to files where match() fails to yield a result? Presumably, those files just get ignored, because if so, then --file-filter idea is redundant. :lol:

Code: Select all

--q "{ folder.name.match(/ID([0-9]{5,11})/) }"
:idea: Please read the FAQ and How to Request Help.
Post Reply