mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
minor fix for LazyLibrarian api.
This commit is contained in:
parent
aee3b151c0
commit
1597763d30
2 changed files with 6 additions and 8 deletions
|
@ -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 =
|
||||||
|
|
|
@ -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),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue