From 8c002a76e05b29f6f35840e9e10af5c173a0e30a Mon Sep 17 00:00:00 2001 From: derrod Date: Sat, 16 Oct 2021 19:44:15 +0200 Subject: [PATCH] [cli/core] Replace old manual game store query with new property --- legendary/cli.py | 11 +++++------ legendary/core.py | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index f254388..c90e1ca 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -234,13 +234,14 @@ class LegendaryCLI: for game in games: print(f' * {game.app_title.strip()} (App name: {game.app_name} | Version: {game.app_version})') if not game.app_version: - _custom_attribs = game.metadata.get('customAttributes', {}) - _store = _custom_attribs.get('ThirdPartyManagedApp', {}).get('value', 'Unknown') + _store = game.third_party_store if _store == 'Origin': print(f' - This game has to be activated, installed, and launched via Origin, use ' f'"legendary launch --origin {game.app_name}" to activate and/or run the game.') - else: + elif _store: print(f' ! This game has to be installed through third-party store ({_store}, not supported)') + else: + print(f' ! No version information (unknown cause)') for dlc in dlc_list[game.asset_info.catalog_item_id]: print(f' + {dlc.app_title} (App name: {dlc.app_name} | Version: {dlc.app_version})') if not dlc.app_version: @@ -623,9 +624,7 @@ class LegendaryCLI: f'to fetch data for Origin titles before using this command.') return - _custom_attribs = game.metadata.get('customAttributes', {}) - _store = _custom_attribs.get('ThirdPartyManagedApp', {}).get('value', None) - if not _store or _store != 'Origin': + if not game.third_party_store or game.third_party_store != 'Origin': logger.error(f'The specified game is not an Origin title.') return diff --git a/legendary/core.py b/legendary/core.py index 2cc98a0..8256f47 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -340,8 +340,7 @@ class LegendaryCore: 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: + if game.third_party_store: return True try: