Page 1 of 1

Conditionally Using --q Option

Posted: 02 Feb 2022, 03:56
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

Re: Conditionally using --q Option

Posted: 02 Feb 2022, 03:59
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

Re: Conditionally using --q Option

Posted: 02 Feb 2022, 04:23
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

Re: Conditionally Using --q Option

Posted: 02 Feb 2022, 04:37
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})/) }"