Add force episode recent search to API.

This commit is contained in:
JackDandy 2016-02-02 12:22:58 +00:00
parent 00da1ce3a4
commit 5a7822db13
2 changed files with 21 additions and 1 deletions

View file

@ -23,6 +23,7 @@
* Add singledispatch 3.4.0.3
* Change refactor email notifier
* Change emails to Unicode aware
* Add force episode recent search to API
### 0.11.5 (2016-02-01 19:40:00 UTC)

View file

@ -728,7 +728,7 @@ class CMD_ComingEpisodes(ApiCall):
# make a dict out of the sql results
sql_results = [dict(row) for row in sql_results]
# multi dimension sort
sorts = {
'date': (lambda a, b: cmp(
@ -1465,6 +1465,24 @@ class CMD_SickBeardDeleteRootDir(ApiCall):
return _responds(RESULT_SUCCESS, _getRootDirs(), msg="Root directory deleted")
class CMD_SickBeardForceSearch(ApiCall):
_help = {'desc': 'force the episode recent search early'}
def __init__(self, handler, args, kwargs):
# required
# optional
# super, missing, help
ApiCall.__init__(self, handler, args, kwargs)
def run(self):
""" force the episode search early """
# Searching all providers for any needed episodes
result = sickbeard.recentSearchScheduler.forceRun()
if result:
return _responds(RESULT_SUCCESS, msg='Episode recent search successfully forced')
return _responds(RESULT_FAILURE, msg='Can not force the episode recent search because it\'s already active')
class CMD_SickBeardGetDefaults(ApiCall):
_help = {"desc": "get sickbeard user defaults"}
@ -2651,6 +2669,7 @@ _functionMaper = {"help": CMD_Help,
"sb.addrootdir": CMD_SickBeardAddRootDir,
"sb.checkscheduler": CMD_SickBeardCheckScheduler,
"sb.deleterootdir": CMD_SickBeardDeleteRootDir,
"sb.forcesearch": CMD_SickBeardForceSearch,
"sb.getdefaults": CMD_SickBeardGetDefaults,
"sb.getmessages": CMD_SickBeardGetMessages,
"sb.getrootdirs": CMD_SickBeardGetRootDirs,