Custom script hooks before grab?

Hi all.

Is there a way to trigger a custom script before a grab is done?

I’m in the process of shifting a bunch of stuff off a NAS box on to a small raspberry pi cluster. The intention is the NAS box (that does double duty as a desktop machine) goes suspends to RAM when not in use.

I’ve got most things set with Wake-on-LAN (autofs works wonders there) but can’t see a way to send a WOL packet or trigger a script before the grab. The earliest hook appears to be “On grab” which as far as I can tell is triggered after Sonarr has successfully passed the request to the download client.

I could move the download client to the cluster but then any downloads are going to be dumping a bunch of extra network traffic on the LAN.

Any suggestions appreciated. Thank you.

No you cannot hook before a grab

I thought that would be the case - the documentation for the *arr projects tends to be very good especially compared to other projects out there.

If I was to put a feature request in is the preference via this forum or on github?

I’m assuming it wouldn’t be as simple (i.e. Something I could muddle through based on the github source!) as the other hooks given they are all post-event hooks rather than pre-event so more of a frame work change.

Maybe this sounds too hacky, but…

If you want to “do stuff” before your download client receives the nzb/torrent, you could use the blackhole client instead, and have a cron job monitor the nzb/torrent folder, send a magic packet, and then send the nzb/torrent to the real download client.
Then have a postprocessing script in the client move the completed download to the blackhole watchfolder (careful when the copy is slow over the network, sonarr will pick up and process files that aren’t done copying yet, best to copy to a folder sonarr can’t see and then do an instant move to the watchfolder on the same volume).
Or something…
It’s late and I’m tired so this might not even make sense to me in the morning.