DownloadEpisodeScan send single api request instead of multiple?

Sonarr version 2.0.0.5338:
Mono version (if Sonarr is not running on Windows):
OS: Windows Server 2016
Description of issue: Not really an issue but just a question regarding api calls.

So I’m making a new script and the goal is to prevent import issues and improve performance, I’m doing this by recording each step a file takes, from extraction to import, the idea is that if a file doesn’t get imported then the next time the script runs it will see this and import the file, however lets say I have 10 or 20 files that need imported, the script would then call sonarr for each file, this is okay if the files are being extracted during that time, but what if it’s a list of pre-extracted files? it will call the api multiple times within second.

So I was curious to know if there was a way to do one api call with all that information in my current version of sonarr or will this be possible in v3? I did try to use the following json array but sonarr does not recognise it, am I doing it wrong or can I only send one at a time? I know I can import using a folder but I wanted to ensure the ClientId was included during import.

[
    {
	"name": "DownloadedEpisodesScan"
        "path":  "D:\import\SeriesName1\",
	"downloadClientId": "234223424",
	"importMode": "Move"
    },
    {
	"name": "DownloadedEpisodesScan"
        "path": "D:\import\SeriesName2\",
	"downloadClientId": "234234242",
	"importMode": "Move"
    }
]

Calling the API multiple times for different files won’t really matter, they’re going to be queued up anyways.

You still can, the recommendation is to pass the job folder not a specific file anyways.

You can’t pass in an array, it’s one command per request.

Thanks for the response I was more worried about maybe sending too many requests in one instance which is why I thought sending one api request with all the data would have been better, but if sonarr can handle it then thats less of a worry for me.

I extract each file to their own directory example: d:\import\filename\file.mkv and then tell sonarr to scan that directory d:\import\filename\ but I only do this because I want to ensure sonarr picks up all the extracted files and assigns the ClientID to them, sometimes these folders may only have one extracted file while others could have an entire season, so my goal was to always keep things organized :slight_smile:

However if I was to just throw them all into one job folder, would sonarr assign the ClientID automatically? assuming sonarr was the one that sent the download request to the download client in the first place.

Shouldn’t be a problem and should be pretty easy to detect if it is, as you wouldn’t get a response (or it’d take ages to reply).

No, it takes in what you pass in, what you’re doing now makes sense, but I misunderstood and thought you were telling Sonarr to process each file in a season pack individually, instead of passing in the job folder for it.

Okay thank you for the help :slight_smile:

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