~exaile-bugday/+junk/exaile

« back to all changes in this revision

Viewing changes to plugins/podcasts/__init__.py

  • Committer: Adam Olsen
  • Date: 2009-07-29 05:05:04 UTC
  • Revision ID: arolsen@gmail.com-20090729050504-u04nllt53wecejtf
load podcasts in separate thread

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
        new_pl.add_tracks(pl.get_tracks())
195
195
        main.mainwindow().add_playlist(new_pl)
196
196
 
197
 
    @guiutil.idle_add()
 
197
    @common.threaded
198
198
    def _load_podcasts(self):
 
199
        self._set_status(_("Loading Podcasts..."))
199
200
        try:
200
201
            h = open(self.podcast_file)
201
202
 
208
209
                self.podcasts.append((title, url))
209
210
        except (IOError, OSError):
210
211
            logger.info('WARNING: could not open podcast file')
211
 
 
 
212
            self._set_status(_('Idle.'))
 
213
            return
 
214
 
 
215
        self._done_loading_podcasts()
 
216
 
 
217
    @guiutil.idle_add()
 
218
    def _done_loading_podcasts(self):
212
219
        self.model.clear()
213
220
        self.podcasts.sort()
214
221
        for (title, url) in self.podcasts:
215
222
            self.model.append([title, url])
216
223
 
 
224
        self._set_status(_('Idle.'))
 
225
 
217
226
    def _save_podcasts(self):
218
227
        try:
219
228
            h = open(self.podcast_file, 'w')