def set_current_cover(self, try_web=True, force_song=None): if not force_song: force_song = self.current_song filename = CoverManager.get_cover(force_song, try_web) if Player.song != force_song: return False if not filename: if not try_web: if force_song.get_type() == "webcast": pixbuf = utils.get_optimum_pixbuf(self.webcast_dpixbuf.get_pixbuf(), COVER_SIZE["x"], COVER_SIZE["y"]) self.start_animation(pixbuf, is_default=True) return True else: pixbuf = utils.get_optimum_pixbuf(self.local_dpixbuf.get_pixbuf(), COVER_SIZE["x"], COVER_SIZE["y"]) self.start_animation(pixbuf, is_default=True) return False return False else: try: pixbuf = get_optimum_pixbuf_from_file(filename, COVER_SIZE["x"], COVER_SIZE["y"]) except gobject.GError: return False else: self.start_animation(pixbuf, is_default=False) return True
def set_current_cover(self, try_web=True, force_song=None): if not force_song: force_song = self.current_song filename = CoverManager.get_cover(force_song, try_web) if Player.song != force_song: return False if not filename: if not try_web: if force_song.get_type() == "webcast": pixbuf = utils.get_optimum_pixbuf( self.webcast_dpixbuf.get_pixbuf(), COVER_SIZE["x"], COVER_SIZE["y"]) self.start_animation(pixbuf, is_default=True) return True else: pixbuf = utils.get_optimum_pixbuf( self.local_dpixbuf.get_pixbuf(), COVER_SIZE["x"], COVER_SIZE["y"]) self.start_animation(pixbuf, is_default=True) return False return False else: try: pixbuf = get_optimum_pixbuf_from_file(filename, COVER_SIZE["x"], COVER_SIZE["y"]) except gobject.GError: return False else: self.start_animation(pixbuf, is_default=False) return True
def get_default_pixbuf(self, song=None): if not song: song = Player.song if not song: pixbuf = self.local_dpixbuf.get_pixbuf() return utils.get_optimum_pixbuf(pixbuf, COVER_SIZE["x"], COVER_SIZE["y"]) if song.get_type() == "webcast": pixbuf = self.webcast_dpixbuf.get_pixbuf() else: pixbuf = self.local_dpixbuf.get_pixbuf() return utils.get_optimum_pixbuf(pixbuf, COVER_SIZE["x"], COVER_SIZE["y"])