From fdaa87df4cce9b64910951a23e9e331241410068 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Mon, 3 Feb 2014 19:42:13 +0100 Subject: [PATCH] Refresh podcasts in display order --- main.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 361ebbf..9c40f67 100644 --- a/main.py +++ b/main.py @@ -118,10 +118,13 @@ class gPotherSide: 'section': podcast.section, } + def _get_podcasts_sorted(self): + return sorted(self.core.model.get_podcasts(), + key=lambda podcast: (podcast.section, podcast.title)) + def load_podcasts(self): - podcasts = self.core.model.get_podcasts() - return [self.convert_podcast(podcast) for podcast in sorted(podcasts, - key=lambda podcast: (podcast.section, podcast.title))] + podcasts = self._get_podcasts_sorted() + return [self.convert_podcast(podcast) for podcast in podcasts] def convert_episode(self, episode): return { @@ -242,7 +245,7 @@ class gPotherSide: self._checking_for_new_episodes = True pyotherside.send('refreshing', True) - podcasts = self.core.model.get_podcasts() + podcasts = self._get_podcasts_sorted() for index, podcast in enumerate(podcasts): pyotherside.send('refresh-progress', index, len(podcasts)) pyotherside.send('updating-podcast', podcast.id)