def init(self): try: self.__current, stations = blautil.deserialize_from_file( blaconst.STATIONS_PATH) except TypeError: return model = self.__treeview.get_model() for station in stations: model.append([None, station]) if self.__current: for row in model: if row[1] == self.__current: self.__treeview.set_cursor(row.path) break self.emit("count_changed", blaconst.VIEW_RADIO, len(model))
def init(self): releases = blautil.deserialize_from_file(blaconst.RELEASES_PATH) if releases: model = gtk.ListStore(gobject.TYPE_PYOBJECT) # Pixbufs aren't initialized when they're unpickled so we need to # instantiate them while restoring. To speed up restoring we force # the use of possibly cached images by passing `restore=True'. for release in releases: try: release.get_cover(restore=True) except AttributeError: pass for release in releases: model.append([release]) self.__treeview.set_model(model) # Check for new releases now and every two hours. self.__update_models() gobject.timeout_add(2 * 3600 * 1000, self.__update_models)
def __init__(self): metadata = blautil.deserialize_from_file(blaconst.METADATA_PATH) self.__metadata = metadata or {"lyrics": {}}
def __restore(self): items = blautil.deserialize_from_file(blaconst.SCROBBLES_PATH) if items: print_d("Re-submitting %d queued scrobble(s)" % len(items)) for item in items: self.put_nowait(item)