Reuse AMC functions within exec

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Reuse AMC functions within exec

Post by devster »

Is it possible/allowed to use getNotificationTitle() and getNotificationTitle() in an exec block?

Code: Select all

$ filebot -script fn:amc ... --def exec="echo {getNotificationTitle()} {getNotificationTitle()}"
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Reuse AMC functions within exec

Post by rednoah »

Sorry, that won't work. The format expression context is completely different from the script execution context, so it's not possible to hook into variables and methods from the other context.
:idea: Please read the FAQ and How to Request Help.
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Reuse AMC functions within exec

Post by devster »

That's too bad. I recently found a command line tool for notifications, https://github.com/caronc/apprise that seems quite flexible. I wanted to use the same format of notification currently used by the AMC script but for Discord, which apprise supports.
I only work in black and sometimes very, very dark grey. (Batman)
devster
Posts: 417
Joined: 06 Jun 2017, 22:56

Re: Reuse AMC functions within exec

Post by devster »

Is it possible to recover the rename log from just the last sequence?
That might have all the info needed to replicate the behaviour of getNotificationTitle() in a separate script.
I only work in black and sometimes very, very dark grey. (Batman)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Reuse AMC functions within exec

Post by rednoah »

FileBot does not keep logs in memory after printing them to console, so there's no way to access them. You'd have to parse the console output and then call commands yourself in your own amc script wrapper shell script.

If you enable html reports, then there'd be html files on your hard disk that you could read to get that piece of information. But not sure if those are written before or after --def exec is called.

You could also try reading the history xml file. But that also probably only gets updated when FileBot exits.
:idea: Please read the FAQ and How to Request Help.
Post Reply