updates to incorporate importMode for NzbDrone/Sonarr and Radarr

This commit is contained in:
hmphargh 2018-07-12 08:33:44 -06:00
commit 94ba0b3354
4 changed files with 18 additions and 5 deletions

View file

@ -148,6 +148,11 @@ class autoProcessMovie(object):
method = cfg["method"]
else:
method = None
#added importMode for Radarr config
if section == "Radarr":
importMode = cfg.get("importMode","Move")
else:
importMode = None
delete_failed = int(cfg["delete_failed"])
wait_for = int(cfg["wait_for"])
ssl = int(cfg.get("ssl", 0))
@ -287,7 +292,7 @@ class autoProcessMovie(object):
logger.postprocess("Starting {0} scan for {1}".format(method, inputName), section)
if section == "Radarr":
payload = {'name': 'DownloadedMoviesScan', 'path': params['media_folder'], 'downloadClientId': download_id}
payload = {'name': 'DownloadedMoviesScan', 'path': params['media_folder'], 'downloadClientId': download_id,'importMode' : importMode}
if not download_id:
payload.pop("downloadClientId")
logger.debug("Opening URL: {0} with PARAMS: {1}".format(baseURL, payload), section)

View file

@ -87,6 +87,8 @@ class autoProcessTV(object):
extract = 0
else:
extract = int(cfg.get("extract", 0))
#get importmode, default to "Move" for consistency with legacy
importMode = cfg.get("importMode","Move")
if not os.path.isdir(dirName) and os.path.isfile(dirName): # If the input directory is a file, assume single file download and split dir/name.
dirName = os.path.split(os.path.normpath(dirName))[0]
@ -270,10 +272,10 @@ class autoProcessTV(object):
# params = {'sortKey': 'series.title', 'page': 1, 'pageSize': 1, 'sortDir': 'asc'}
if remote_path:
logger.debug("remote_path: {0}".format(remoteDir(dirName)), section)
data = {"name": "DownloadedEpisodesScan", "path": remoteDir(dirName), "downloadClientId": download_id, "importMode": "Move"}
data = {"name": "DownloadedEpisodesScan", "path": remoteDir(dirName), "downloadClientId": download_id, "importMode": importMode}
else:
logger.debug("path: {0}".format(dirName), section)
data = {"name": "DownloadedEpisodesScan", "path": dirName, "downloadClientId": download_id, "importMode": "Move"}
data = {"name": "DownloadedEpisodesScan", "path": dirName, "downloadClientId": download_id, "importMode": importMode}
if not download_id:
data.pop("downloadClientId")
data = json.dumps(data)