Delay Import or Trigger Import via Script

Hello, my current setup has a post-processing script trigged by my torrent client to do some processing on the episode file that was downloaded. This takes a few minutes to complete.

Part of that process is using Filebot to rename the episode. I am not using Sonarr to rename at the moment, but I would like to move to this (one less thing.)

I still need to post-process the file, so I need to either have Sonarr delay the import from the watched directory or leave Sonarr’s processing “off” and have my script trigger it when it completes.

I’m not sure the best way (or if there is a way) to do this. Looking for any advice someone may have.

Thanks in advance!

Sonarr won’t delay unless the client says it’s running a script, which torrent clients don’t, you can trigger the import via the API from a script though:

Thanks! Very helpful! I’m using an api call for something else already so that’ll be cake.

I’m curious how strict this is based on the word “should”:

“A folder specified by the path variable is assumed to be a single download (job) and the folder name should be the release name.”

Most downloads will come as a single file with no encompassing directory. It would seem to be “extra scripting” work to have to create a directory, move the file into it, when, I assume, the non-api called import does not require it.

My intent to be to do the post processing I need in the download location that is set and then call the import with the api. My guess is I’d leave “completed download handling” to “disabled” since I’m calling it manually.

Sonarr will use the folder name to get some information and also assume any file in that folder is acceptable to import, if there are multiple files in there when you tell it to process the folder Sonarr will attempt to process them all, which would be a problem if they are from two separate downloads.

In this case a folder is highly recommended and might not work without one (I forget offhand).

Correct.

One more idea just came to me, you could have your download client process files to one folder, then in a final step move them to another folder and use Sonarr’s Remote Path Mapping to override the path to watch the second folder (this can be done even if Sonarr and the download client aren’t on different machines, the feature is designed for remote download clients though), that way the files are processed and Sonarr doesn’t see them until they are done. You’d need to make sure all files in a season pack appear at the same time.

That would eliminate the need for a “job folder”, any call to the API and continue to use Completed Download Handling.

That is a really good idea since my download client isn’t on the same box as Sonarr. I could do just that.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.