Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect games specifying "the EA app" for their ThirdPartyManagedApp as Origin games #632

Merged
merged 1 commit into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions legendary/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def list_games(self, args):
# a third-party application (such as Origin).
if not version:
_store = game.third_party_store
if _store == 'Origin':
if game.is_origin_game:
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.')
elif _store:
Expand Down Expand Up @@ -722,7 +722,7 @@ def _launch_origin(self, args):
f'to fetch data for Origin titles before using this command.')
return

if not game.third_party_store or game.third_party_store != 'Origin':
if not game.is_origin_game:
logger.error(f'The specified game is not an Origin title.')
return

Expand Down Expand Up @@ -856,7 +856,7 @@ def install_game(self, args):

if store := game.third_party_store:
logger.error(f'The selected title has to be installed via a third-party store: {store}')
if store == 'Origin':
if game.is_origin_game:
logger.info(f'For Origin games use "legendary launch --origin {args.app_name}" to '
f'activate and/or run the game.')
exit(0)
Expand Down Expand Up @@ -2125,7 +2125,7 @@ def read_service_response(response):
logger.info('Redeemed all outstanding Uplay codes.')
elif args.origin:
na_games, _ = self.core.get_non_asset_library_items(skip_ue=True)
origin_games = [game for game in na_games if game.third_party_store == 'Origin']
origin_games = [game for game in na_games if game.is_origin_game]

if not origin_games:
logger.info('No redeemable games found.')
Expand Down
6 changes: 5 additions & 1 deletion legendary/models/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ def is_dlc(self):
return self.metadata and 'mainGameItem' in self.metadata

@property
def third_party_store(self):
def is_origin_game(self) -> bool:
return self.third_party_store and self.third_party_store.lower() in ['origin', 'the ea app']

@property
def third_party_store(self) -> Optional[str]:
if not self.metadata:
return None
return self.metadata.get('customAttributes', {}).get('ThirdPartyManagedApp', {}).get('value', None)
Expand Down
Loading