1
0
Fork 0
mirror of synced 2024-06-26 18:20:50 +12:00

ImageManager: Add OfferImageTall to the set of image types to look for

Seems like Epic are changing their API again, and some image types have been renamed. This made the list of updates to be empty after filtering it for image types we could handle. This also had the side effect of an infinite recursion when downloading images, as the resulting pixmap would be null.

To fix this situation, the new image type has been added, and the image loading in RareGame has become two methods, one for loading and one for setting it.

Signed-off-by: loathingKernel <142770+loathingKernel@users.noreply.github.com>
This commit is contained in:
loathingKernel 2023-03-10 10:35:31 +02:00
parent 901f339415
commit 3adabda1ba
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
3 changed files with 9 additions and 7 deletions

View file

@ -467,10 +467,12 @@ class RareGame(RareGameSlim):
def set_pixmap(self):
self.pixmap = self.image_manager.get_pixmap(self.app_name, self.is_installed)
if not self.pixmap.isNull():
self.signals.widget.update.emit()
def load_pixmap(self):
if self.pixmap.isNull():
self.image_manager.download_image(self.game, self.set_pixmap, 0, False)
else:
self.signals.widget.update.emit()
def refresh_pixmap(self):
self.image_manager.download_image(self.game, self.set_pixmap, 0, True)

View file

@ -139,8 +139,8 @@ class ImageManager(QObject):
def __init__(self, signals: GlobalSignals, core: LegendaryCore):
# lk: the ordering in __img_types matters for the order of fallbacks
# self.__img_types: Tuple = ("DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo", "DieselGameBox")
self.__img_types: Tuple = ("DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo")
# self.__img_types: Tuple = ("DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo", "DieselGameBox", "OfferImageTall")
self.__img_types: Tuple = ("DieselGameBoxTall", "Thumbnail", "DieselGameBoxLogo", "OfferImageTall")
self.__dl_retries = 1
self.__worker_app_names: List[str] = []
super(QObject, self).__init__()
@ -178,7 +178,8 @@ class ImageManager(QObject):
def __prepare_download(self, game: Game, force: bool = False) -> Tuple[List, Dict]:
if force and self.__img_dir(game.app_name).exists():
self.__img_color(game.app_name).unlink(missing_ok=True)
self.__img_color(game.app_name).unlink(missing_ok=True)
self.__img_gray(game.app_name).unlink(missing_ok=True)
self.__img_desktop_icon(game.app_name).unlink(missing_ok=True)
if not self.__img_dir(game.app_name).is_dir():
self.__img_dir(game.app_name).mkdir()

View file

@ -338,7 +338,6 @@ class RareCore(QObject):
origin_worker.signals.result.connect(self.handle_result)
QThreadPool.globalInstance().start(origin_worker)
def fetch_extra(self):
non_asset_worker = NonAssetWorker(self.__core, self.__args)
non_asset_worker.signals.result.connect(self.handle_result)
@ -368,7 +367,7 @@ class RareCore(QObject):
def __load_pixmaps(self) -> None:
# time.sleep(0.1)
for rgame in self.__games.values():
rgame.set_pixmap()
rgame.load_pixmap()
# time.sleep(0.0001)
@property