mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core] Add "asset_available" helper function
This commit is contained in:
parent
fa9e650ea1
commit
841db6bcb6
|
@ -338,6 +338,18 @@ class LegendaryCore:
|
||||||
def asset_valid(self, app_name) -> bool:
|
def asset_valid(self, app_name) -> bool:
|
||||||
return any(i.app_name == app_name for i in self.lgd.assets)
|
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:
|
def get_game(self, app_name, update_meta=False) -> Game:
|
||||||
if update_meta:
|
if update_meta:
|
||||||
self.get_game_list(True)
|
self.get_game_list(True)
|
||||||
|
|
Loading…
Reference in a new issue