def downloadPixbufAlbumCover(url): if debug: print("downloading album cover from " + url) f = File.new_for_uri(url) stream = f.read() cover = Pixbuf.new_from_stream(stream) stream.close() return cover
def get_gicon_for_file(uri): """ Return a GIcon representing the file at the @uri, which can be *either* and uri or a path return None if not found """ gfile = File.new_for_path(uri) if not gfile.query_exists(): gfile = File.new_for_uri(uri) if not gfile.query_exists(): return None finfo = gfile.query_info(FILE_ATTRIBUTE_STANDARD_ICON, Gio.FileQueryInfoFlags.NONE, None) gicon = finfo.get_attribute_object(FILE_ATTRIBUTE_STANDARD_ICON) return gicon