diff --git a/legendary/api/egs.py b/legendary/api/egs.py index 1f9dd871..025fc77c 100644 --- a/legendary/api/egs.py +++ b/legendary/api/egs.py @@ -186,13 +186,24 @@ def get_launcher_manifests(self, platform='Windows', label=None): r.raise_for_status() return r.json() - def get_user_entitlements(self): + def get_user_entitlements(self, start=0): user_id = self.user.get('account_id') r = self.session.get(f'https://{self._entitlements_host}/entitlement/api/account/{user_id}/entitlements', - params=dict(start=0, count=5000), timeout=self.request_timeout) + params=dict(start=start, count=1000), timeout=self.request_timeout) r.raise_for_status() return r.json() + def get_user_entitlements_full(self): + ret = [] + + while True: + resp = self.get_user_entitlements(start=len(ret)) + ret.extend(resp) + if len(resp) < 1000: + break + + return ret + def get_game_info(self, namespace, catalog_item_id, timeout=None): r = self.session.get(f'https://{self._catalog_host}/catalog/api/shared/namespace/{namespace}/bulk/items', params=dict(id=catalog_item_id, includeDLCDetails=True, includeMainGameDetails=True, diff --git a/legendary/cli.py b/legendary/cli.py index c77cc71a..3ab7b962 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -1657,7 +1657,7 @@ def info(self, args): else: logger.info('Game not installed and offline mode enabled, cannot load manifest.') elif game: - entitlements = self.core.egs.get_user_entitlements() + entitlements = self.core.egs.get_user_entitlements_full() egl_meta = self.core.egs.get_game_info(game.namespace, game.catalog_item_id) game.metadata = egl_meta # Get manifest if asset exists for current platform @@ -2046,7 +2046,7 @@ def activate(self, args): redeemed = {k['gameId'] for k in key_list if k['redeemedOnUplay']} games = self.core.get_game_list() - entitlements = self.core.egs.get_user_entitlements() + entitlements = self.core.egs.get_user_entitlements_full() owned_entitlements = {i['entitlementName'] for i in entitlements} uplay_games = []