mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-15 09:42:54 -07:00
Fix TypeError for missing keys by type-casting config to dict
This commit is contained in:
parent
b4541d3236
commit
a4fd80e695
5 changed files with 57 additions and 46 deletions
|
@ -16,13 +16,15 @@ class autoProcessComics(object):
|
||||||
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.", section)
|
logger.warning("FAILED DOWNLOAD DETECTED, nothing to process.", section)
|
||||||
return [1, "{0}: Failed to post-process. {1} does not support failed downloads".format(section, section)]
|
return [1, "{0}: Failed to post-process. {1} does not support failed downloads".format(section, section)]
|
||||||
|
|
||||||
host = core.CFG[section][inputCategory]["host"]
|
cfg = dict(core.CFG[section][inputCategory])
|
||||||
port = core.CFG[section][inputCategory]["port"]
|
|
||||||
username = core.CFG[section][inputCategory]["username"]
|
host = cfg["host"]
|
||||||
password = core.CFG[section][inputCategory]["password"]
|
port = cfg["port"]
|
||||||
ssl = int(core.CFG[section][inputCategory].get("ssl", 0))
|
username = cfg["username"]
|
||||||
web_root = core.CFG[section][inputCategory].get("web_root", "")
|
password = cfg["password"]
|
||||||
remote_path = int(core.CFG[section][inputCategory].get("remote_path"), 0)
|
ssl = int(cfg.get("ssl", 0))
|
||||||
|
web_root = cfg.get("web_root", "")
|
||||||
|
remote_path = int(cfg.get("remote_path"), 0)
|
||||||
protocol = "https://" if ssl else "http://"
|
protocol = "https://" if ssl else "http://"
|
||||||
|
|
||||||
url = "{0}{1}:{2}{3}/post_process".format(protocol, host, port, web_root)
|
url = "{0}{1}:{2}{3}/post_process".format(protocol, host, port, web_root)
|
||||||
|
|
|
@ -15,12 +15,14 @@ class autoProcessGames(object):
|
||||||
def process(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
|
def process(self, section, dirName, inputName=None, status=0, clientAgent='manual', inputCategory=None):
|
||||||
status = int(status)
|
status = int(status)
|
||||||
|
|
||||||
host = core.CFG[section][inputCategory]["host"]
|
cfg = dict(core.CFG[section][inputCategory])
|
||||||
port = core.CFG[section][inputCategory]["port"]
|
|
||||||
apikey = core.CFG[section][inputCategory]["apikey"]
|
host = cfg["host"]
|
||||||
library = core.CFG[section][inputCategory].get("library")
|
port = cfg["port"]
|
||||||
ssl = int(core.CFG[section][inputCategory].get("ssl", 0))
|
apikey = cfg["apikey"]
|
||||||
web_root = core.CFG[section][inputCategory].get("web_root", "")
|
library = cfg.get("library")
|
||||||
|
ssl = int(cfg.get("ssl", 0))
|
||||||
|
web_root = cfg.get("web_root", "")
|
||||||
protocol = "https://" if ssl else "http://"
|
protocol = "https://" if ssl else "http://"
|
||||||
|
|
||||||
url = "{0}{1}:{2}{3}/api".format(protocol, host, port, web_root)
|
url = "{0}{1}:{2}{3}/api".format(protocol, host, port, web_root)
|
||||||
|
|
|
@ -105,16 +105,18 @@ class autoProcessMovie(object):
|
||||||
|
|
||||||
def process(self, section, dirName, inputName=None, status=0, clientAgent="manual", download_id="", inputCategory=None, failureLink=None):
|
def process(self, section, dirName, inputName=None, status=0, clientAgent="manual", download_id="", inputCategory=None, failureLink=None):
|
||||||
|
|
||||||
host = core.CFG[section][inputCategory]["host"]
|
cfg = dict(core.CFG[section][inputCategory])
|
||||||
port = core.CFG[section][inputCategory]["port"]
|
|
||||||
apikey = core.CFG[section][inputCategory]["apikey"]
|
host = cfg["host"]
|
||||||
method = core.CFG[section][inputCategory]["method"]
|
port = cfg["port"]
|
||||||
delete_failed = int(core.CFG[section][inputCategory]["delete_failed"])
|
apikey = cfg["apikey"]
|
||||||
wait_for = int(core.CFG[section][inputCategory]["wait_for"])
|
method = cfg["method"]
|
||||||
ssl = int(core.CFG[section][inputCategory].get("ssl", 0))
|
delete_failed = int(cfg["delete_failed"])
|
||||||
web_root = core.CFG[section][inputCategory].get("web_root", "")
|
wait_for = int(cfg["wait_for"])
|
||||||
remote_path = int(core.CFG[section][inputCategory].get("remote_path", 0))
|
ssl = int(cfg.get("ssl", 0))
|
||||||
extract = int(core.CFG[section][inputCategory].get("extract", 0))
|
web_root = cfg.get("web_root", "")
|
||||||
|
remote_path = int(cfg.get("remote_path", 0))
|
||||||
|
extract = int(cfg.get("extract", 0))
|
||||||
protocol = "https://" if ssl else "http://"
|
protocol = "https://" if ssl else "http://"
|
||||||
|
|
||||||
baseURL = "{0}{1}:{2}{3}/api/{4}".format(protocol, host, port, web_root, apikey)
|
baseURL = "{0}{1}:{2}{3}/api/{4}".format(protocol, host, port, web_root, apikey)
|
||||||
|
|
|
@ -42,14 +42,16 @@ class autoProcessMusic(object):
|
||||||
def process(self, section, dirName, inputName=None, status=0, clientAgent="manual", inputCategory=None):
|
def process(self, section, dirName, inputName=None, status=0, clientAgent="manual", inputCategory=None):
|
||||||
status = int(status)
|
status = int(status)
|
||||||
|
|
||||||
host = core.CFG[section][inputCategory]["host"]
|
cfg = dict(core.CFG[section][inputCategory])
|
||||||
port = core.CFG[section][inputCategory]["port"]
|
|
||||||
apikey = core.CFG[section][inputCategory]["apikey"]
|
host = cfg["host"]
|
||||||
wait_for = int(core.CFG[section][inputCategory]["wait_for"])
|
port = cfg["port"]
|
||||||
ssl = int(core.CFG[section][inputCategory].get("ssl", 0))
|
apikey = cfg["apikey"]
|
||||||
web_root = core.CFG[section][inputCategory].get("web_root", "")
|
wait_for = int(cfg["wait_for"])
|
||||||
remote_path = int(core.CFG[section][inputCategory].get("remote_path", 0))
|
ssl = int(cfg.get("ssl", 0))
|
||||||
extract = int(core.CFG[section][inputCategory].get("extract", 0))
|
web_root = cfg.get("web_root", "")
|
||||||
|
remote_path = int(cfg.get("remote_path", 0))
|
||||||
|
extract = int(cfg.get("extract", 0))
|
||||||
protocol = "https://" if ssl else "http://"
|
protocol = "https://" if ssl else "http://"
|
||||||
|
|
||||||
url = "{0}{1}:{2}{3}/api".format(protocol, host, port, web_root)
|
url = "{0}{1}:{2}{3}/api".format(protocol, host, port, web_root)
|
||||||
|
|
|
@ -52,10 +52,13 @@ class autoProcessTV(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def processEpisode(self, section, dirName, inputName=None, failed=False, clientAgent="manual", download_id=None, inputCategory=None, failureLink=None):
|
def processEpisode(self, section, dirName, inputName=None, failed=False, clientAgent="manual", download_id=None, inputCategory=None, failureLink=None):
|
||||||
host = core.CFG[section][inputCategory]["host"]
|
|
||||||
port = core.CFG[section][inputCategory]["port"]
|
cfg = dict(core.CFG[section][inputCategory])
|
||||||
ssl = int(core.CFG[section][inputCategory].get("ssl", 0))
|
|
||||||
web_root = core.CFG[section][inputCategory].get("web_root", "")
|
host = cfg["host"]
|
||||||
|
port = cfg["port"]
|
||||||
|
ssl = int(cfg.get("ssl", 0))
|
||||||
|
web_root = cfg.get("web_root", "")
|
||||||
protocol = "https://" if ssl else "http://"
|
protocol = "https://" if ssl else "http://"
|
||||||
|
|
||||||
if not server_responding("{0}{1}:{2}{3}".format(protocol, host, port, web_root)):
|
if not server_responding("{0}{1}:{2}{3}".format(protocol, host, port, web_root)):
|
||||||
|
@ -65,17 +68,17 @@ class autoProcessTV(object):
|
||||||
# auto-detect correct fork
|
# auto-detect correct fork
|
||||||
fork, fork_params = autoFork(section, inputCategory)
|
fork, fork_params = autoFork(section, inputCategory)
|
||||||
|
|
||||||
username = core.CFG[section][inputCategory].get("username", "")
|
username = cfg.get("username", "")
|
||||||
password = core.CFG[section][inputCategory].get("password", "")
|
password = cfg.get("password", "")
|
||||||
apikey = core.CFG[section][inputCategory].get("apikey", "")
|
apikey = cfg.get("apikey", "")
|
||||||
delete_failed = int(core.CFG[section][inputCategory].get("delete_failed", 0))
|
delete_failed = int(cfg.get("delete_failed", 0))
|
||||||
nzbExtractionBy = core.CFG[section][inputCategory].get("nzbExtractionBy", "Downloader")
|
nzbExtractionBy = cfg.get("nzbExtractionBy", "Downloader")
|
||||||
process_method = core.CFG[section][inputCategory].get("process_method")
|
process_method = cfg.get("process_method")
|
||||||
remote_path = int(core.CFG[section][inputCategory].get("remote_path", 0))
|
remote_path = int(cfg.get("remote_path", 0))
|
||||||
wait_for = int(core.CFG[section][inputCategory].get("wait_for", 2))
|
wait_for = int(cfg.get("wait_for", 2))
|
||||||
force = int(core.CFG[section][inputCategory].get("force", 0))
|
force = int(cfg.get("force", 0))
|
||||||
delete_on = int(core.CFG[section][inputCategory].get("delete_on", 0))
|
delete_on = int(cfg.get("delete_on", 0))
|
||||||
extract = int(core.CFG[section][inputCategory].get("extract", 0))
|
extract = int(cfg.get("extract", 0))
|
||||||
|
|
||||||
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.
|
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]
|
dirName = os.path.split(os.path.normpath(dirName))[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue