Update Heroic import
This commit is contained in:
@@ -61,46 +61,36 @@ def heroic_parser(parent_widget, action):
|
|||||||
# Import Epic games
|
# Import Epic games
|
||||||
if not schema.get_boolean("heroic-import-epic"):
|
if not schema.get_boolean("heroic-import-epic"):
|
||||||
pass
|
pass
|
||||||
elif os.path.exists(os.path.join(heroic_dir, "lib-cache", "installInfo.json")) and os.path.exists(
|
elif os.path.exists(os.path.join(heroic_dir, "lib-cache", "library.json")):
|
||||||
os.path.join(heroic_dir, "lib-cache", "library.json")):
|
|
||||||
open_file = open(os.path.join(heroic_dir, "lib-cache", "installInfo.json"), "r")
|
|
||||||
data = open_file.read()
|
|
||||||
open_file.close()
|
|
||||||
installInfo = json.loads(data)
|
|
||||||
|
|
||||||
open_file = open(os.path.join(heroic_dir, "lib-cache", "library.json"), "r")
|
open_file = open(os.path.join(heroic_dir, "lib-cache", "library.json"), "r")
|
||||||
data = open_file.read()
|
data = open_file.read()
|
||||||
library = json.loads(data)
|
library = json.loads(data)
|
||||||
open_file.close()
|
open_file.close()
|
||||||
for item in installInfo:
|
|
||||||
if installInfo[item].get("install") is not None:
|
|
||||||
values = {}
|
|
||||||
app_name = installInfo[item]["game"]["app_name"]
|
|
||||||
|
|
||||||
values["game_id"] = "heroic_epic_" + app_name
|
for game in library["library"]:
|
||||||
|
if game["is_installed"] == False:
|
||||||
|
continue
|
||||||
|
|
||||||
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[
|
values = {}
|
||||||
values["game_id"]].keys():
|
|
||||||
continue
|
|
||||||
|
|
||||||
values["name"] = installInfo[item]["game"]["title"]
|
app_name = game["app_name"]
|
||||||
values["executable"] = "xdg-open heroic://launch/" + app_name
|
values["game_id"] = "heroic_epic_" + app_name
|
||||||
values["hidden"] = False
|
|
||||||
values["source"] = "heroic_epic"
|
|
||||||
values["added"] = current_time
|
|
||||||
values["last_played"] = 0
|
|
||||||
|
|
||||||
for game in library["library"]:
|
if values["game_id"] in parent_widget.games and "removed" not in parent_widget.games[values["game_id"]].keys():
|
||||||
if game["app_name"] == app_name:
|
continue
|
||||||
image_path = os.path.join(heroic_dir, "images-cache",
|
|
||||||
hashlib.sha256((game[
|
|
||||||
"art_square"] + "?h=400&resize=1&w=300").encode()).hexdigest())
|
|
||||||
if os.path.exists(image_path):
|
|
||||||
values["pixbuf_options"] = save_cover(values, parent_widget, image_path)
|
|
||||||
|
|
||||||
break
|
values["name"] = game["title"]
|
||||||
|
values["executable"] = "xdg-open heroic://launch/" + app_name
|
||||||
|
values["hidden"] = False
|
||||||
|
values["source"] = "heroic_epic"
|
||||||
|
values["added"] = current_time
|
||||||
|
values["last_played"] = 0
|
||||||
|
|
||||||
heroic_games[values["game_id"]] = values
|
image_path = os.path.join(heroic_dir, "images-cache", hashlib.sha256((game["art_square"] + "?h=400&resize=1&w=300").encode()).hexdigest())
|
||||||
|
if os.path.exists(image_path):
|
||||||
|
values["pixbuf_options"] = save_cover(values, parent_widget, image_path)
|
||||||
|
|
||||||
|
heroic_games[values["game_id"]] = values
|
||||||
|
|
||||||
# Import GOG games
|
# Import GOG games
|
||||||
if not schema.get_boolean("heroic-import-gog"):
|
if not schema.get_boolean("heroic-import-gog"):
|
||||||
|
|||||||
Reference in New Issue
Block a user