minor fix for LazyLibrarian api.

This commit is contained in:
clinton-hall 2019-03-29 10:38:59 +13:00
commit 1597763d30
2 changed files with 6 additions and 8 deletions

View file

@ -283,8 +283,8 @@
watch_dir = watch_dir =
[LazyLibrarian] [LazyLibrarian]
#### autoProcessing for Games #### autoProcessing for LazyLibrarian
#### games - category that gets called for post-processing with Gamez #### books - category that gets called for post-processing with LazyLibrarian
[[books]] [[books]]
enabled = 0 enabled = 0
apikey = apikey =

View file

@ -36,12 +36,11 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
input_name, dir_name = convert_to_ascii(input_name, dir_name) input_name, dir_name = convert_to_ascii(input_name, dir_name)
params = { params = {
'api_key': apikey, 'apikey': apikey,
'cmd': 'forceProcess', 'cmd': 'forceProcess',
'dir': dir_name, 'dir': dir_name,
} }
logger.debug('Opening URL: {0} with params: {1}'.format(url, params), section)
logger.debug('Opening URL: {0}'.format(url), section)
try: try:
r = requests.get(url, params=params, verify=False, timeout=(30, 300)) r = requests.get(url, params=params, verify=False, timeout=(30, 300))
@ -52,8 +51,7 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
status_code=1, status_code=1,
) )
result = r.json() logger.postprocess('{0}'.format(r.text), section)
logger.postprocess('{0}'.format(result), section)
if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]: if r.status_code not in [requests.codes.ok, requests.codes.created, requests.codes.accepted]:
logger.error('Server returned status {0}'.format(r.status_code), section) logger.error('Server returned status {0}'.format(r.status_code), section)
@ -61,7 +59,7 @@ def process(section, dir_name, input_name=None, status=0, client_agent='manual',
message='{0}: Failed to post-process - Server returned status {1}'.format(section, r.status_code), message='{0}: Failed to post-process - Server returned status {1}'.format(section, r.status_code),
status_code=1, status_code=1,
) )
elif result['success']: elif r.text == 'OK':
logger.postprocess('SUCCESS: ForceProcess for {0} has been started in LazyLibrarian'.format(dir_name), section) logger.postprocess('SUCCESS: ForceProcess for {0} has been started in LazyLibrarian'.format(dir_name), section)
return ProcessResult( return ProcessResult(
message='{0}: Successfully post-processed {1}'.format(section, input_name), message='{0}: Successfully post-processed {1}'.format(section, input_name),