Use blacklist for non-game items

This commit is contained in:
kramo
2023-03-15 23:46:34 +01:00
parent 0b3beed6d8
commit eb3f9a8b8e
3 changed files with 16 additions and 11 deletions

View File

@@ -48,6 +48,7 @@ class game(Gtk.Box):
self.name = data["name"] self.name = data["name"]
self.developer = data["developer"] if "developer" in data.keys() else None self.developer = data["developer"] if "developer" in data.keys() else None
self.removed = "removed" in data.keys() self.removed = "removed" in data.keys()
self.blacklisted = "blacklisted" in data.keys()
self.pixbuf = get_cover(self.game_id, self.parent_widget) self.pixbuf = get_cover(self.game_id, self.parent_widget)

View File

@@ -140,7 +140,7 @@ def steam_parser(parent_widget, action):
basic_data = json.loads(content)[values["appid"]] basic_data = json.loads(content)[values["appid"]]
if not basic_data["success"]: if not basic_data["success"]:
steam_games.pop(values["game_id"]) steam_games[values["game_id"]]["blacklisted"] = True
else: else:
data = basic_data["data"] data = basic_data["data"]
steam_games[values["game_id"]]["developer"] = ", ".join( steam_games[values["game_id"]]["developer"] = ", ".join(
@@ -148,7 +148,7 @@ def steam_parser(parent_widget, action):
) )
if data["type"] != "game": if data["type"] != "game":
steam_games.pop(values["game_id"]) steam_games[values["game_id"]]["blacklisted"] = True
except GLib.GError: except GLib.GError:
pass pass
@@ -157,25 +157,27 @@ def steam_parser(parent_widget, action):
if not queue: if not queue:
import_dialog.close() import_dialog.close()
if not steam_games: games_no = len(
create_dialog( {
parent_widget, game_id: final_values
_("No Games Found"), for game_id, final_values in steam_games.items()
_("No new games were found in the Steam library."), if "blacklisted" not in final_values.keys()
) }
elif len(steam_games) == 1: )
if games_no == 1:
create_dialog( create_dialog(
parent_widget, parent_widget,
_("Steam Games Imported"), _("Steam Games Imported"),
_("Successfully imported 1 game."), _("Successfully imported 1 game."),
) )
elif len(steam_games) > 1: elif games_no > 1:
create_dialog( create_dialog(
parent_widget, parent_widget,
_("Steam Games Imported"), _("Steam Games Imported"),
_("Successfully imported") _("Successfully imported")
+ " " + " "
+ str(len(steam_games)) + str(games_no)
+ " " + " "
+ _("games."), + _("games."),
) )

View File

@@ -144,6 +144,8 @@ class CartridgesWindow(Adw.ApplicationWindow):
if entry.removed: if entry.removed:
continue continue
if entry.blacklisted:
continue
if not self.games[game_id].hidden: if not self.games[game_id].hidden:
self.visible_widgets[game_id] = entry self.visible_widgets[game_id] = entry