use expressions in manual query (--q )?

All your suggestions, requests and ideas for future development
Post Reply
andy22
Posts: 10
Joined: 17 Aug 2020, 16:59

use expressions in manual query (--q )?

Post by andy22 »

Similar to: viewtopic.php?f=6&t=11137&p=46409&hilit=anidb#p46409

I do a pre-pass (via a hasher tool) that actually does a filelookup via AniDB hash and i store the ID's in the temp filename "Seriesname - Ep01 - [AID123456]"

Now filebot could directly do a lookup via this ID, yet the expression is not evaluated for "--q".

Code: Select all

filebot --action TEST --log INFO -rename "Seriesname - Ep01 - [AID123456].mkv" --db AniDB --q "{fn.match(/AID(\d{1,9})/)}"

Code: Select all

Failed to fetch episode data: [{fn.match(/AID(\d{1,9})/)}]
Failed to identify or process any files
So is there a way to make this work or workaround?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: use expressions in manual query (--q )?

Post by rednoah »

The --q option can be used in the following ways:

Code: Select all

--q 123456

Code: Select all

--q "Series Name"

If you want to pass in a specific --q option value for a specific file, then you need to take care of that in a higher level script and then call filebot --q 123456 accordingly for each file.


You can user PowerShell or bash for that but if you're familiar with Groovy then a custom script will be easier:
https://www.filebot.net/script.html

Code: Select all

args
.getFiles{ it.video }
.groupBy{ it.name.match(/AID(\d{1,9})/) }
.each{ aid, fs ->
	rename(file: fs, query: aid)
}
:idea: Please read the FAQ and How to Request Help.
andy22
Posts: 10
Joined: 17 Aug 2020, 16:59

Re: use expressions in manual query (--q )?

Post by andy22 »

ok thanks for the quick reply, guess i need to dig deeper into Groovy.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: use expressions in manual query (--q )?

Post by rednoah »

FileBot r7926 adds support for --q expressions as envisioned in the OP:

Code: Select all

--q "{fn.match(/AID(\d{1,9})/)}"
This will also enable other use cases such a "search by parent folder name"

Code: Select all

--q "{folder.name}"
as well as allow for completely manual / custom script query auto-detection:

Code: Select all

--q /path/to/query.groovy
:idea: Please read the FAQ and How to Request Help.
andy22
Posts: 10
Joined: 17 Aug 2020, 16:59

Re: use expressions in manual query (--q )?

Post by andy22 »

oh cool thanks!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: use expressions in manual query (--q )?

Post by rednoah »

:idea: Please read the FAQ and How to Request Help.
Post Reply