From 841db6bcb681932193e1ec6c41953448d0291a21 Mon Sep 17 00:00:00 2001 From: derrod Date: Sat, 16 Oct 2021 18:59:18 +0200 Subject: [PATCH] [core] Add "asset_available" helper function --- legendary/core.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/legendary/core.py b/legendary/core.py index ec89067..2cc98a0 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -338,6 +338,18 @@ class LegendaryCore: def asset_valid(self, app_name) -> bool: return any(i.app_name == app_name for i in self.lgd.assets) + def asset_available(self, game: Game) -> bool: + # Just say yes for Origin titles + _store = game.metadata.get('customAttributes', {}).get('ThirdPartyManagedApp', {}).get('value', None) + if _store: + return True + + try: + asset = self.get_asset(game.app_name) + return asset is not None + except ValueError: + return False + def get_game(self, app_name, update_meta=False) -> Game: if update_meta: self.get_game_list(True)