Advice on method for Merging piles of shows into Sonarr

Sonarr version
Mono version
Debug logs:
Asking for advice on merge procedures.:

I have lots of directories filled with collections of shows. Some of the shows might exist in Sonarr already, but perhaps some of the episodes are unique. Of course, many are duplicates. And worse, many are worse quality duplicates.

The series name tag is normally good enough for Sonarr to identify any given show. And most episodes are tagged with the appropriate S00E00 string. I find that I can ask Sonarr to AddSeries -> ImportExistingSeriesOnDisk, and it will identify duplicated shows easy enough. I than simply click + on the rest of the shows, and wait till the pane catches up and notifications tell me its done.

Next I jump over to the Series Editor and find all the shows I imported by finding the ones that match the imported path. I select the batch, and change the Root Folder, so its the same as the rest of my Sonarr managed library.

Course, the selected group does not retain its selection. And since I am sorting on Path, soon as they change, they disappear into the pile. It would be handy to keep them selected, as I find that for best results, right about now I need to Update Library. Which takes a lot less time if I just do the few I might have imported… Shrug. Once its updated, all these series will be added to Sonarr, and the directories are right. But all the files are still over in the other pile.

Next, I use the Wanted, Manual Import option, and point it right at the same directory I just used AddSeries against. Here I have tried using the Automatic mode, but it just never seems todo anything for me. Compared, if I click Manual import. I see a wonderful list of all the movies from that pile. In the right series, tagged properly. And even compared to existing as duplicate, or poorer quality. So I just need to select everything but the red flagged ones, and ask Sonarr to Move them all.

Tada! I just merged one more pile of stuff. So many little, and not so little, piles. It is a bit tedious though. So I am hoping someone can help enlighten me how to automate this process of merging piles of data into Sonarr.

Thanks in advance for helping a beginner make the switch. I shaved off the beard, got rid of all my rage, and feel I am using the best toolkit for the job. Thanks much for putting it all together.


Manual import is likely the best way. For the automatic mode to work you’d have to go folder by folder since it’s intended to work with a single job folder from a download client (though a single series folder will likely work as well).

I decided to point the import from disk at a pile, match up what I could, and then used a short quick and dirty python script to find the series with the piles path, and both change the path in Sonarr, as well move the files for that series. Well, actually just dump shell commands to let me move things. Shrug. Works. Does open up lots of doors for doing things though… Yes the following is ugly, and short of minimal things like error handling and the like… but everything evolves :slight_smile:

import json
import os
import requests

sonarr = 'http://media:8989/api/series?apikey=someapikeygoeshere'
headers = {'content-type': 'application/json'}
resp = requests.get(sonarr,headers=headers)
series = resp.json()
for item in series:
    votes = item["ratings"]
    genres = item["genres"]
    if "Documentary" in genres:
        if (item["path"].find("sonarr") != -1):
            newpath = item["path"].replace("sonarr","Documentary")
            newpath = newpath.replace("'","'\"'\"'")
            oldpath = item["path"].replace("'","'\"'\"'")
	    item.update({"path": newpath})
            data = json.dumps(item)
            resp = requests.put(sonarr,data,headers=headers)
            newitem = resp.json()
       	    print("mv '{}' '{}'".format(oldpath,newpath))

1 Like