mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 02:26:53 -07:00
Updated logger code to now include the section, formatting has been modified as well.
Logging of debug messages is now optional via log_debug option location in autoProcessMedia.cfg Lots of code cleanup has been performed including cleanup log messages and corrections of spelling errors. Improved release lookup code for autoProcessMovie, narrows search results down by making API calls to the download clients to compare results in CouchPotato's database.
This commit is contained in:
parent
dd41ff3b2f
commit
eb7822b60b
16 changed files with 420 additions and 441 deletions
|
@ -7,21 +7,13 @@ from nzbtomedia import logger
|
|||
|
||||
class autoProcessComics:
|
||||
def processEpisode(self, dirName, nzbName=None, status=0, clientAgent='manual', inputCategory=None):
|
||||
if dirName is None:
|
||||
logger.error("No directory was given!")
|
||||
return 1 # failure
|
||||
|
||||
# auto-detect correct section
|
||||
section = nzbtomedia.CFG.findsection(inputCategory)
|
||||
if not section:
|
||||
logger.error(
|
||||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file.", inputCategory)
|
||||
"We were unable to find a section for category %s, please check your autoProcessMedia.cfg file." % inputCategory)
|
||||
return 1
|
||||
|
||||
logger.postprocess("#########################################################")
|
||||
logger.postprocess("## ..::[%s]::.. :: CATEGORY:[%s]", section, inputCategory)
|
||||
logger.postprocess("#########################################################")
|
||||
|
||||
host = nzbtomedia.CFG[section][inputCategory]["host"]
|
||||
port = nzbtomedia.CFG[section][inputCategory]["port"]
|
||||
username = nzbtomedia.CFG[section][inputCategory]["username"]
|
||||
|
@ -59,16 +51,16 @@ class autoProcessComics:
|
|||
protocol = "http://"
|
||||
|
||||
url = "%s%s:%s%s/post_process" % (protocol, host, port, web_root)
|
||||
logger.debug("Opening URL: %s", url)
|
||||
logger.debug("Opening URL: %s" % (url), section)
|
||||
|
||||
try:
|
||||
r = requests.get(url, params=params, auth=(username, password), stream=True)
|
||||
except requests.ConnectionError:
|
||||
logger.error("Unable to open URL")
|
||||
logger.error("Unable to open URL", section)
|
||||
return 1 # failure
|
||||
|
||||
for line in r.iter_lines():
|
||||
if line: logger.postprocess("%s", line)
|
||||
if line: logger.postprocess("%s" % (line), section)
|
||||
|
||||
time.sleep(60) #wait 1 minute for now... need to see just what gets logged and how long it takes to process
|
||||
return 0 # Success
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue