mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-22 14:13:33 -07:00
Reduce number of return paths.
This commit is contained in:
parent
2b049f6b20
commit
dc37deb6e2
1 changed files with 20 additions and 17 deletions
|
@ -68,24 +68,25 @@ class PyMedusaApiV1(SickBeard):
|
||||||
f'Server returned status {response.status_code}',
|
f'Server returned status {response.status_code}',
|
||||||
self.sb_init.section,
|
self.sb_init.section,
|
||||||
)
|
)
|
||||||
return ProcessResult(
|
result = ProcessResult(
|
||||||
message=f'{self.sb_init.section}: Failed to post-process - '
|
message=f'{self.sb_init.section}: Failed to post-process - '
|
||||||
f'Server returned status {response.status_code}',
|
f'Server returned status {response.status_code}',
|
||||||
status_code=1,
|
status_code=1,
|
||||||
)
|
)
|
||||||
|
elif response.json()['result'] == 'success':
|
||||||
if response.json()['result'] == 'success':
|
result = ProcessResult(
|
||||||
return ProcessResult(
|
|
||||||
message=f'{self.sb_init.section}: '
|
message=f'{self.sb_init.section}: '
|
||||||
f'Successfully post-processed {self.input_name}',
|
f'Successfully post-processed {self.input_name}',
|
||||||
status_code=0,
|
status_code=0,
|
||||||
)
|
)
|
||||||
return ProcessResult(
|
else:
|
||||||
message=f'{self.sb_init.section}: Failed to post-process - '
|
result = ProcessResult(
|
||||||
f'Returned log from {self.sb_init.section} was not as '
|
message=f'{self.sb_init.section}: Failed to post-process - '
|
||||||
f'expected.',
|
f'Returned log from {self.sb_init.section} was not as '
|
||||||
status_code=1, # We did not receive Success confirmation.
|
f'expected.',
|
||||||
)
|
status_code=1, # We did not receive Success confirmation.
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
class PyMedusaApiV2(SickBeard):
|
class PyMedusaApiV2(SickBeard):
|
||||||
|
@ -201,14 +202,16 @@ class PyMedusaApiV2(SickBeard):
|
||||||
# In the future we could return an exit state for when the PP in
|
# In the future we could return an exit state for when the PP in
|
||||||
# medusa didn't yield an expected result.
|
# medusa didn't yield an expected result.
|
||||||
if response.get('success'):
|
if response.get('success'):
|
||||||
return ProcessResult(
|
result = ProcessResult(
|
||||||
message=f'{self.sb_init.section}: '
|
message=f'{self.sb_init.section}: '
|
||||||
f'Successfully post-processed {self.input_name}',
|
f'Successfully post-processed {self.input_name}',
|
||||||
status_code=0,
|
status_code=0,
|
||||||
)
|
)
|
||||||
return ProcessResult(
|
else:
|
||||||
message=f'{self.sb_init.section}: Failed to post-process - '
|
result = ProcessResult(
|
||||||
f'Returned log from {self.sb_init.section} was not '
|
message=f'{self.sb_init.section}: Failed to post-process - '
|
||||||
f'as expected.',
|
f'Returned log from {self.sb_init.section} was not '
|
||||||
status_code=1, # We did not receive Success confirmation.
|
f'as expected.',
|
||||||
)
|
status_code=1, # We did not receive Success confirmation.
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue