From f0cb9177fb865ba44361a156c42ed577ef2a4ea0 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Apr 2014 15:59:01 +0200 Subject: [PATCH 1/2] API now accepts either indexerid or tvdbid for backward compability with third party applications --- sickbeard/webapi.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index bc2dc3af..b72df0a9 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -373,6 +373,10 @@ class ApiCall(object): """ function to check passed params for the shorthand wrapper and to detect missing/required param """ + # Fix for applications that send tvdbid instead of indexerid + if key == "indexerid" and "indexerid" not in kwargs: + key = "tvdbid" + missing = True orgDefault = default From 5abd9b2f97996774756883a64ce344c1c5f93f14 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Apr 2014 17:56:40 +0200 Subject: [PATCH 2/2] Now returns both tvdbid and indexerid for 'future', 'history', 'sb.searchtvdb' and 'shows' --- sickbeard/webapi.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sickbeard/webapi.py b/sickbeard/webapi.py index b72df0a9..b5c20d0b 100644 --- a/sickbeard/webapi.py +++ b/sickbeard/webapi.py @@ -803,6 +803,8 @@ class CMD_ComingEpisodes(ApiCall): ep["airs"] = str(ep["airs"]).replace('am', ' AM').replace('pm', ' PM').replace(' ', ' ') # start day of the week on 1 (monday) ep["weekday"] = 1 + datetime.date.fromordinal(ordinalAirdate).weekday() + # Add tvdbid for backward compability + ep["tvdbid"] = ep['indexerid'] # TODO: check if this obsolete if not status in finalEpResults: @@ -1168,6 +1170,8 @@ class CMD_History(ApiCall): _rename_element(row, "showid", "indexerid") row["resource_path"] = os.path.dirname(row["resource"]) row["resource"] = os.path.basename(row["resource"]) + # Add tvdbid for backward compability + ep["tvdbid"] = ep['indexerid'] results.append(row) myDB.connection.close() @@ -1596,6 +1600,7 @@ class CMD_SickBeardSearchIndexers(ApiCall): results = [] for curSeries in series: results.append({"indexerid": int(curSeries.findtext('seriesid')), + "tvdbid": int(curSeries.findtext('seriesid')), "name": curSeries.findtext('SeriesName'), "first_aired": curSeries.findtext('FirstAired')}) @@ -1626,6 +1631,7 @@ class CMD_SickBeardSearchIndexers(ApiCall): return _responds(RESULT_FAILURE, msg="Show contains no name, invalid result") showOut = [{"indexerid": self.indexerid, + "tvdbid": self.indexerid, "name": unicode(myShow.data['seriesname']), "first_aired": myShow.data['firstaired']}] @@ -2533,6 +2539,7 @@ class CMD_Shows(ApiCall): "air_by_date": curShow.air_by_date, "sports": curShow.sports, "indexerid": curShow.indexerid, + "tvdbid": curShow.indexerid, "network": curShow.network, "show_name": curShow.name, "status": curShow.status,