Enable auto-import option per download client

Hi,

Request: Move the auto-import option from a global setting to a selectable option for individual download clients.

I recently added encoding to my workflow and it’s presented a new/unique problem with Sonarr that could be solved by tweaking the auto import option. Here’s my workflow, but I think this would apply to anyone wanting to do something with a file before it gets imported:

  1. Sonarr queues a download via any download client.
  2. Handbrake monitors the destination folder and begins encoding automatically once the download is complete.
  3. Handbrake outputs the new file into a new destination monitored by Sonarr (via a “black hole” download client)
  4. Sonarr imports the newly encoded file

The problem is Sonarr is importing the newly downloaded files before Handbrake is able to encode them because the option to auto-import is global. It enables it for all or none of the download clients. Being able to set “auto import” by individual download client would allow a user to download via any desired client with the setting off, allowing encoding or any other desired action to take place, and then have one download client with auto import enabled (a black hole client monitoring a given directory, for example) perform the auto-import function. In this way, files would only be imported once the workflow is complete.

I thought this was how Radarr operated as recently as last week, but I checked today after an update and it is similar to Sonarr’s current model. Not sure if I’m crazy, or if this is a recent change, so I apologize if I’m requesting a feature reversion. Perhaps hiding a per-client setting as an ‘advanced option’ would be appropriate if auto-import was recently generalized as a global option for a specific reason.

I’m aware this could also be solved by disabling the global auto-import option and manually importing, but that dulls the appeal of Sonarr’s automation. Having an advanced option that enables customized workflows would be much appreciated. Thanks for your consideration!

You’d typically do that (encoding) in a post-processing script in the download client, which reports the download as complete after the post-processing script is done. Then you don’t need the flaky blackhole setup.

Interesting. I don’t normally go out of my way to make feature requests, but after posting last night I was browsing the settings options and saw a post-process script option under Media Management. Is this the same you’re referencing?

Also, did the auto-import feature used to be set per client vs. globally or am I just crazy? I’m curious what the benefit of the change would have been or if I’ve just got a serious case of the Mandela effect.

I disagree that the blackhole config is flaky. It was easy to setup and has worked really well. The GUI options do everything wonderfully, Sonarr just deletes files before they’re able to be transcoded if a second or more arrive before the first one is finished due to the auto-import. Again, I could turn it off but then I have to manually import. I know, I know…it’s the most first-world catch 22 ever.

Sounds like there’s another way to skin the cat, and I’m not averse to figuring out the scripting approach, but I still think it’d be a value-added change for commoners like myself. I appreciate your consideration either way.

No, that is post-processing after sonarr has imported the file. That can be used for example for custom notification scripts which aren’t covered by standard connections.

It might be tempting to launch your encoding via that, but the problem is sonarr will lose track of the files if you change the name or extension, and can wipe the transcoded file after a disk rescan because it doesn’t know it anymore.

I was really talking about a script that runs in your download client. Most have that option nowadays.

Re flakiness of the blackhole folder: people typically don’t consider sonarr just periodically scans it and processes whatever is in there. There is no logic, since it can’t ask a program “are you done? can I import the file?”
If you start unpacking or encoding or even slowly copying a finished file across volumes in there, you’ll have sonarr process incomplete files sooner or later.
Based on your response you’re doing something like that.

You (or your script) need to do whatever you need to do to the files in a folder sonarr can’t see. So you can merrily encode as long as you want.
Assuming the files are now ready for importing:
If they’re not on the same volume as the blackhole folder yet, move them to the same volume as the blackhole folder first, in a folder sonarr can’t see/process. This action might take some time, during which you don’t want sonarr to grab the incomplete files which are still copying!
Once done, you move the files into the blackhole folder. The move will be instant so sonarr doesn’t have the chance to snatch incomplete files.

Or you copy files to the non-sonarr directory in the same volume first, then encode, then move into blackhole, whichever suits your workflow best. Just remember to treat blackhole as “if I blink my eyes sonarr might have snatched the file” so anything you place in there should be there instantly and ready for processing by sonarr.

Not a dev and can’t remember, but I think the option you talk about has always been global.

Per the text for that option I think it can be used for this purpose

Import Using Script
“Copy files for importing using a script (ex. for transcoding)”

However it would be a global setting, and not per client as requested. For per client currently it would still need to be done as you have outlined.

Wow, what an adventure.

I explored using a post-processing script in my download client (Sab, btw). It should have been easy, but took 3 days of troubleshooting to figure out because writing the script on windows caused invisible “line endings” that made the script error out as “not found” upon execution. I would never have figured that one out without a very helpful member on the Sab forums. #lessonlearned.

I’m happy where things have ended up, as Sonarr will now download and import automatically, which makes things immediately available to watch. With the post-processing script, the file will also copy automatically and self-queue for encoding, which Sonarr will then import upon completion, saving storage in the long run.

I still think auto-import options per client could be handy, but appreciate the kick in the rear that took me down this road.