diff --git a/gui/slick/js/addTrendingShow.js b/gui/slick/js/addTrendingShow.js index 3122e385..137acce0 100644 --- a/gui/slick/js/addTrendingShow.js +++ b/gui/slick/js/addTrendingShow.js @@ -1,10 +1,20 @@ $(document).ready(function() { - function loadContent() { - $('#trendingShows').html(' loading trending shows...'); - $.get(sbRoot+'/home/addShows/getTrendingShows/', function(data) { - $('#trendingShows').html(data); - }); + var trendingRequestXhr = null; + function loadContent() { + if (trendingRequestXhr) trendingRequestXhr.abort(); + + $('#trendingShows').html(' loading trending shows...'); + trendingRequestXhr = $.ajax({ + url: sbRoot + '/home/addShows/getTrendingShows/', + timeout: 60 * 1000, + error: function () { + $('#trendingShows').empty().html('Trakt timed out, refresh page to try again'); + }, + success: function (data) { + $('#trendingShows').html(data); + } + }); } loadContent(); diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index e3e2c168..bdac89e2 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -2249,7 +2249,8 @@ class HomeAddShows(Home): trakt_api = TraktAPI(sickbeard.TRAKT_API, sickbeard.TRAKT_USERNAME, sickbeard.TRAKT_PASSWORD) try: - for show in trakt_api.traktRequest("shows/trending.json/%APIKEY%") or []: + shows = trakt_api.traktRequest("shows/trending.json/%APIKEY%") or [] + for show in shows: try: if not helpers.findCertainShow(sickbeard.showList, [int(show['tvdb_id']), int(show['tvrage_id'])]):