Browse Source

Add client parameter to pp class and add it to API sg.postprocess.

Change API version to 14.
tags/release_0.25.1
Prinz23 5 years ago
committed by JackDandy
parent
commit
b467653c0e
  1. 2
      CHANGES.md
  2. 12
      sickbeard/processTV.py
  3. 14
      sickbeard/webapi.py
  4. 2
      sickbeard/webserve.py

2
CHANGES.md

@ -5,6 +5,8 @@
* Change remove `app` from URL when calling webhook
* Change remind user when testing Notifications config / Discord to update URL
* Fix incorrect text for some drop down list items in the apiBuilder view that affected some browsers
* Add client parameter to pp class and add it to API sg.postprocess
* Change API version to 14
* Change add a test for both require and ignore show specific words with partial match, both should fail
* Change init showDict for all unit tests
* Update attr 20.1.0.dev0 (4bd6827) to 20.2.0 (4f74fba)

12
sickbeard/processTV.py

@ -58,7 +58,7 @@ if False:
class ProcessTVShow(object):
""" Process a TV Show """
def __init__(self, webhandler=None, is_basedir=True, skip_failure_processing=False):
def __init__(self, webhandler=None, is_basedir=True, skip_failure_processing=False, client=None):
self.files_passed = 0 # type: int
self.files_failed = 0 # type: int
self.fail_detected = False # type: bool
@ -66,6 +66,7 @@ class ProcessTVShow(object):
self._output = [] # type: List
self.webhandler = webhandler
self.is_basedir = is_basedir # type: bool
self.client = client # type: Optional[AnyStr]
@property
def any_vid_processed(self):
@ -1161,7 +1162,7 @@ class ProcessTVShow(object):
# backward compatibility prevents the case of this function name from being updated to PEP8
def processDir(dir_name, nzb_name=None, process_method=None, force=False, force_replace=None,
failed=False, pp_type='auto', cleanup=False, webhandler=None, show_obj=None, is_basedir=True,
skip_failure_processing=False):
skip_failure_processing=False, client=None):
"""
:param dir_name: dir name
@ -1188,12 +1189,15 @@ def processDir(dir_name, nzb_name=None, process_method=None, force=False, force_
:type is_basedir: bool
:param skip_failure_processing:
:type skip_failure_processing: bool
:param client: string to represent the client
:type client: Optional[AnyStr]
:return:
:rtype: AnyStr
"""
# backward compatibility prevents the case of this function name from being updated to PEP8
return ProcessTVShow(webhandler, is_basedir, skip_failure_processing=skip_failure_processing).process_dir(
dir_name, nzb_name, process_method, force, force_replace, failed, pp_type, cleanup, show_obj)
return ProcessTVShow(webhandler, is_basedir, skip_failure_processing=skip_failure_processing,
client=client).process_dir(dir_name, nzb_name, process_method, force, force_replace, failed,
pp_type, cleanup, show_obj)
def process_minimal(nzb_name, show_obj, failed, webhandler):

14
sickbeard/webapi.py

@ -129,7 +129,7 @@ class PythonObjectEncoder(json.JSONEncoder):
class Api(webserve.BaseHandler):
""" api class that returns json results """
version = 13 # use an int since float-point is unpredictable
version = 14 # use an int since float-point is unpredictable
indent = 4
def check_xsrf_cookie(self):
@ -1896,6 +1896,7 @@ class CMD_SickGearPostProcess(ApiCall):
"is_priority": {"desc": "Replace file(s) even if existing at a higher quality"},
"type": {"desc": "Type of media process request this is, auto or manual"},
"failed": {"desc": "Mark as failed download"},
"client": {"desc": "String representing the calling client"},
}
}
@ -1908,8 +1909,9 @@ class CMD_SickGearPostProcess(ApiCall):
self.process_method, args = self.check_params(args, kwargs, "process_method", False, False, "string", [
"copy", "symlink", "hardlink", "move"])
self.is_priority, args = self.check_params(args, kwargs, "is_priority", 0, False, "bool", [])
self.type, args = self.check_params(args, kwargs, "type", "auto", None, "string", ["auto", "manual"])
self.type, args = self.check_params(args, kwargs, "type", "auto", False, "string", ["auto", "manual"])
self.failed, args = self.check_params(args, kwargs, "failed", 0, False, "bool", [])
self.client, args = self.check_params(args, kwargs, "client", None, False, "string", [])
# super, missing, help
ApiCall.__init__(self, handler, args, kwargs)
@ -1925,7 +1927,8 @@ class CMD_SickGearPostProcess(ApiCall):
self.type = 'manual'
data = processTV.processDir(self.path, process_method=self.process_method, force=self.force_replace,
force_replace=self.is_priority, failed=self.failed, pp_type=self.type)
force_replace=self.is_priority, failed=self.failed, pp_type=self.type,
client=self.client)
if not self.return_data:
data = ""
@ -1951,6 +1954,11 @@ class CMD_PostProcess(CMD_SickGearPostProcess):
# super, missing, help
self.sickbeard_call = True
kwargs['failed'] = "0"
try:
if 'client' in kwargs:
del kwargs['client']
except (BaseException, Exception):
pass
CMD_SickGearPostProcess.__init__(self, handler, args, kwargs)

2
sickbeard/webserve.py

@ -3323,7 +3323,7 @@ class HomeProcessMedia(Home):
failed='0' != failed,
webhandler=None if '0' == stream else self.send_message,
show_obj=show_obj, is_basedir=is_basedir in ('on', '1'),
skip_failure_processing=skip_failure_processing)
skip_failure_processing=skip_failure_processing, client=client)
if '0' == stream:
regexp = re.compile(r'(?i)<br(?:[\s/]+)>', flags=re.UNICODE)

Loading…
Cancel
Save