def _get_thumb_rhythmbox(self): artist = self.object[0]["artist"] album = unicode(self) bs_artist_album = \ " - ".join([us.encode("ascii", "ignore") for us in (artist, album)]) \ + ".jpg" return config.get_cache_file(("rhythmbox", "covers", bs_artist_album))
def _get_thumb_mediaart(self): """old thumb location""" ltitle = unicode(self).lower() # ignore the track artist -- use the space fallback # hash of ' ' as fallback hspace = "7215ee9c7d9dc229d2921a40e899ec5f" htitle = md5(_tostr(ltitle)).hexdigest() hartist = hspace cache_name = "album-%s-%s.jpeg" % (hartist, htitle) return config.get_cache_file(("media-art", cache_name))
def _get_thumb_mediaart(self): """old thumb location""" ltitle = str(self).lower() # ignore the track artist -- use the space fallback # hash of ' ' as fallback hspace = "7215ee9c7d9dc229d2921a40e899ec5f" htitle = md5(_toutf8_lossy(ltitle)).hexdigest() hartist = hspace cache_name = "album-%s-%s.jpeg" % (hartist, htitle) return config.get_cache_file(("media-art", cache_name))
def get_thumbnail(self, width, height): if not hasattr(self, "cover_file"): ltitle = unicode(self).lower() # ignore the track artist -- use the space fallback # hash of ' ' as fallback hspace = "7215ee9c7d9dc229d2921a40e899ec5f" htitle = md5(_tostr(ltitle)).hexdigest() hartist = hspace cache_name = "album-%s-%s.jpeg" % (hartist, htitle) cache_file = config.get_cache_file(("media-art", cache_name)) # now try filesystem if not cache_file: uri = self.object[0]["location"] gfile = gio.File(uri) for cover_name in ("album.jpg", "cover.jpg"): cfile = gfile.resolve_relative_path("../" + cover_name) if cfile.query_exists(): cache_file = cfile.get_path() break self.cover_file = cache_file return icons.get_pixbuf_from_file(self.cover_file, width, height)
def _get_thumb_rhythmbox(self): artist = self.object[0]["artist"] album = unicode(self) return config.get_cache_file(("rhythmbox", "covers", "%s - %s.jpg" % (artist, album)))