321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374 | def load(self, category, force=False, y=None):
# called to early
if not category:
log.ERR("load(None)")
return
self.current = category
# get data from cache or download
if force or not category in self.streams:
log.PROC("load", "update_streams")
self.status("Updating streams...")
self.status(-0.1)
if category == "empty":
new_streams = self.empty_stub
else:
new_streams = self.update_streams(category)
# Postprocess new list of streams (e.g. assert existing title and url)
if new_streams:
try:
new_streams = self.postprocess(new_streams)
except Exception as e:
log.ERR("Updating new streams, postprocessing failed:", e)
# don't lose forgotten streams
if conf.retain_deleted:
self.streams[category] = new_streams + self.deleted_streams(new_streams, self.streams.get(category,[]))
else:
self.streams[category] = new_streams
# save in cache
self.save()
else:
# parse error
self.status("Category parsed empty.")
self.streams[category] = self.nothing_found
log.INFO("Oooops, parser returned nothing for category " + category)
# Update treeview/model (if category is still selected)
if self.current == category:
log.UI("load() → uikit.columns({}.streams[{}])".format(self.module, category), [inspect.stack()[x][3] for x in range(1,5)])
uikit.do(self.columns, self.prepare(self.streams[category]))
if y:
uikit.do(self.gtk_list.scroll_to_point, 0, y + 1) # scroll to previous position, +1 px, because
# somehow Gtk.TreeView else stumbles over itself when scrolling to the same position the 2nd time
# unset statusbar
self.status()
# Called occasionally (by some plugins) while updating station list
def update_streams_partially_done(self, entries): |
>
>
<
<
<
>
>
>
>
| 321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377 | def load(self, category, force=False, y=None):
# called to early
if not category:
log.ERR("load(None)")
return
self.current = category
do_save = False
# get data from cache or download
if force or not category in self.streams:
log.PROC("load", "update_streams")
self.status("Updating streams...")
self.status(-0.1)
if category == "empty":
new_streams = self.empty_stub
else:
new_streams = self.update_streams(category)
# Postprocess new list of streams (e.g. assert existing title and url)
if new_streams:
try:
new_streams = self.postprocess(new_streams)
do_save = True
except Exception as e:
log.ERR("Updating new streams, postprocessing failed:", e)
# don't lose forgotten streams
if conf.retain_deleted:
self.streams[category] = new_streams + self.deleted_streams(new_streams, self.streams.get(category,[]))
else:
self.streams[category] = new_streams
else:
# parse error
self.status("Category parsed empty.")
self.streams[category] = self.nothing_found
log.INFO("Oooops, parser returned nothing for category " + category)
# Update treeview/model (if category is still selected)
if self.current == category:
log.UI("load() → uikit.columns({}.streams[{}])".format(self.module, category), [inspect.stack()[x][3] for x in range(1,5)])
uikit.do(self.columns, self.prepare(self.streams[category]))
if y:
uikit.do(self.gtk_list.scroll_to_point, 0, y + 1) # scroll to previous position, +1 px, because
# somehow Gtk.TreeView else stumbles over itself when scrolling to the same position the 2nd time
# save in cache
if do_save:
self.save()
# unset statusbar
self.status()
# Called occasionally (by some plugins) while updating station list
def update_streams_partially_done(self, entries): |