From 254a8a48e7f9d5aee6304073678f5b03e29e4bd2 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 13 Jun 2021 00:05:14 +0200 Subject: [PATCH] Fix developer and title of some games --- rare/components/tabs/shop/shop_info.py | 1 - rare/components/tabs/shop/shop_models.py | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/rare/components/tabs/shop/shop_info.py b/rare/components/tabs/shop/shop_info.py index c3bb6f11..140571b3 100644 --- a/rare/components/tabs/shop/shop_info.py +++ b/rare/components/tabs/shop/shop_info.py @@ -72,7 +72,6 @@ class ShopGameInfo(QWidget, Ui_shop_info): else: return self.game = ShopGame.from_json(game, self.data) - # print(game) self.title.setText(self.game.title) self.price.setText(self.game.price) diff --git a/rare/components/tabs/shop/shop_models.py b/rare/components/tabs/shop/shop_models.py index 23e367fb..7e313b57 100644 --- a/rare/components/tabs/shop/shop_models.py +++ b/rare/components/tabs/shop/shop_models.py @@ -44,6 +44,8 @@ class ShopGame: @classmethod def from_json(cls, api_data: dict, search_data: dict): + print(api_data) + print(search_data) if isinstance(api_data, list): for product in api_data: if product["_title"] == "home": @@ -53,7 +55,7 @@ class ShopGame: tmp = cls() if "pages" in api_data.keys(): api_data = api_data["pages"][0] - tmp.title = api_data.get("productName", api_data.get("_title", "fail")) + tmp.title = search_data.get("title", "Fail") tmp.image_urls = _ImageUrlModel.from_json(search_data["keyImages"]) links = api_data["data"]["socialLinks"] tmp.links = [] @@ -69,8 +71,12 @@ class ShopGame: tmp.reqs[system["systemType"]][req["title"]] = (req["minimum"], req["recommended"]) except KeyError: pass - tmp.publisher = api_data["data"]["meta"].get("publisher", "undefined") - tmp.developer = api_data["data"]["meta"].get("developer", "undefined") + tmp.publisher = api_data["data"]["meta"].get("publisher", "") + tmp.developer = api_data["data"]["meta"].get("developer", "") + if not tmp.developer: + for i in search_data["customAttributes"]: + if i["key"] == "developerName": + tmp.developer = i["value"] tmp.price = search_data['price']['totalPrice']['fmtPrice']['originalPrice'] tmp.discount_price = search_data['price']['totalPrice']['fmtPrice']['discountPrice']