Skip to content

Commit

Permalink
Bugfixes for empty TV favourites and sort problem
Browse files Browse the repository at this point in the history
  • Loading branch information
SumnerH committed Mar 24, 2015
1 parent d5badd1 commit a1f6122
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion default.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def parse_tvshows_recommended(self, request, list_type, full_liz, date_liz = Non
if xbmc.abortRequested:
break
json_query2 = self.WINDOW.getProperty( prefix + "-data-" + str( item['tvshowid'] ) )
if json_query:
if json_query2:
json_query2 = simplejson.loads(json_query2)
if json_query2.has_key('result') and json_query2['result'] != None and json_query2['result'].has_key('episodes'):
for item2 in json_query2['result']['episodes']:
Expand Down
5 changes: 3 additions & 2 deletions library.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ def query_recommended_movies():
def _fetch_recommended_episodes(self, useCache = False):
def query_recommended_episodes():
# First we get a list of all the in-progress TV shows.
json_query_string = self.json_query("VideoLibrary.GetTVShows", unplayed=True, properties=self.tvshow_properties,
query_filter=self.inprogress_filter)
json_query_string = self.json_query("VideoLibrary.GetTVShows", unplayed=True, properties=self.tvshow_properties, sort={"order":"descending", "method":"lastplayed"}, query_filter=self.inprogress_filter)
json_query = json.loads(json_query_string)

# If we found any, find the oldest unwatched show for each one.
Expand Down Expand Up @@ -191,6 +190,8 @@ def query_favourite():
if favs['result']['favourites'] is None:
return None
shows = json.loads(self.json_query("VideoLibrary.GetTVShows", unplayed=True, properties=self.tvshow_properties, limit=None))
if not shows.has_key('result') or not shows['result'].has_key('tvshows'):
return None
fav_unwatched = [ show for show in shows['result']['tvshows'] if show['title'] in
set([ fav['title'] for fav in favs['result']['favourites'] if fav['type'] == 'window']) ]

Expand Down

0 comments on commit a1f6122

Please sign in to comment.