diff --git a/CHANGES.md b/CHANGES.md index a58e596e..7fd6f8e6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index ec2aaf4b..07f3e98a 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -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,