def _get_album_art_lastfm(self, artist, album): """ Get album artwork from lastfm @param artist as string @param album as string @return pixbuf as GdkPixbuf.Pixbuf @tread safe """ pixbuf = None if Lp().lastfm is not None: try: last_album = Lp().lastfm.get_album(artist, album) url = last_album.get_cover_image(4) if url is not None: s = Gio.File.new_for_uri(url) (status, data, tag) = s.load_contents() if status: stream = Gio.MemoryInputStream.new_from_data( data, None) pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale( stream, ArtSize.MONSTER, ArtSize.MONSTER, False, None) except Exception as e: print("ArtDownloader::_get_album_art_lastfm: %s" % e) return pixbuf
def _get_album_art_lastfm(self, artist, album): """ Get album artwork from lastfm @param artist as string @param album as string @return pixbuf as GdkPixbuf.Pixbuf @tread safe """ pixbuf = None if Lp().lastfm is not None: try: last_album = Lp().lastfm.get_album(artist, album) url = last_album.get_cover_image(4) if url is not None: s = Gio.File.new_for_uri(url) (status, data, tag) = s.load_contents() if status: stream = Gio.MemoryInputStream.new_from_data(data, None) pixbuf = GdkPixbuf.Pixbuf.new_from_stream_at_scale( stream, ArtSize.MONSTER, ArtSize.MONSTER, False, None) except Exception as e: print("ArtDownloader::_get_album_art_lastfm: %s" % e) return pixbuf
def _get_album_art_lastfm(self, artist, album): """ Get album artwork from lastfm @param artist as string @param album as string @return data as bytes @tread safe """ image = None if Lp().lastfm is not None: try: last_album = Lp().lastfm.get_album(artist, album) url = last_album.get_cover_image(4) if url is not None: s = Gio.File.new_for_uri(url) (status, image, tag) = s.load_contents() except Exception as e: print("ArtDownloader::_get_album_art_lastfm: %s" % e) return image
def _get_lastfm_album_artwork(self, artist, album): """ Get album artwork from lastfm @param artist as string @param album as string @return data as bytes @tread safe """ image = None if Lp().lastfm is not None: try: last_album = Lp().lastfm.get_album(artist, album) url = last_album.get_cover_image(4) if url is not None: s = Lio.File.new_for_uri(url) (status, image, tag) = s.load_contents() except Exception as e: print("Downloader::_get_album_art_lastfm: %s [%s/%s]" % (e, artist, album)) return image
def _get_lastfm_album_artwork(self, artist, album): """ Get album artwork from lastfm @param artist as string @param album as string @return data as bytes @tread safe """ image = None if Lp().lastfm is not None: try: helper = TaskHelper() last_album = Lp().lastfm.get_album(artist, album) uri = last_album.get_cover_image(4) if uri is not None: (status, image) = helper.load_uri_content_sync(uri, None) except Exception as e: print("Downloader::_get_album_art_lastfm: %s [%s/%s]" % (e, artist, album)) return image