Esempio n. 1
0
	def get_thumbnail(self, width, height):
		if not (hasattr(self, "cover_data") or hasattr(self, "cover_file")):
			cover_file = self._get_thumb_local()
			if cover_file:
				self.cover_file = cover_file
			if _MUTAGEN and not hasattr(self, "cover_file"):
				cover_data = self._get_thumb_metadata()
				if cover_data:
					self.cover_data = cover_data

		try:
			if hasattr(self, "cover_file"):
				return icons.get_pixbuf_from_file(self.cover_file, width, height)
			elif hasattr(self, "cover_data"):
				return icons.get_pixbuf_from_data(self.cover_data, width, height)
		except(glib.GError):
			pass
Esempio n. 2
0
    def get_thumbnail(self, width, height):
        if not (hasattr(self, "cover_data") or hasattr(self, "cover_file")):
            cover_file = self._get_thumb_local()
            if cover_file:
                self.cover_file = cover_file
            if _MUTAGEN and not hasattr(self, "cover_file"):
                cover_data = self._get_thumb_metadata()
                if cover_data:
                    self.cover_data = cover_data

        try:
            if hasattr(self, "cover_file"):
                return icons.get_pixbuf_from_file(self.cover_file, width,
                                                  height)
            elif hasattr(self, "cover_data"):
                return icons.get_pixbuf_from_data(self.cover_data, width,
                                                  height)
        except (glib.GError):
            pass
Esempio n. 3
0
	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)
Esempio n. 4
0
File: pidgin.py Progetto: pbx/kupfer
 def get_thumbnail(self, width, height):
     if not self.icon:
         return
     return icons.get_pixbuf_from_file(self.icon, width, height)
Esempio n. 5
0
	def get_thumbnail(self, width, height):
		if not hasattr(self, "cover_file"):
			self.cover_file = (self._get_thumb_rhythmbox() or
			                   self._get_thumb_mediaart() or
			                   self._get_thumb_local())
		return icons.get_pixbuf_from_file(self.cover_file, width, height)
Esempio n. 6
0
 def get_thumbnail(self, width, height):
     if not hasattr(self, "cover_file"):
         self.cover_file = (self._get_thumb_mediaart()
                            or self._get_thumb_local())
     return icons.get_pixbuf_from_file(self.cover_file, width, height)
Esempio n. 7
0
 def get_thumbnail(self, width, height):
     return icons.get_pixbuf_from_file(self._img, width, height)
Esempio n. 8
0
	def get_thumbnail(self, width, height):
		if not self.icon:
			return
		return icons.get_pixbuf_from_file(self.icon, width, height)
Esempio n. 9
0
 def get_thumbnail(self, width, height):
     return icons.get_pixbuf_from_file(self._img, width, height)