(self, args)
| 1600 | self.core.update_available = False |
| 1601 | |
| 1602 | def info(self, args): |
| 1603 | name_or_path = args.app_name_or_manifest |
| 1604 | app_name = manifest_uri = None |
| 1605 | if os.path.exists(name_or_path) or name_or_path.startswith('http'): |
| 1606 | manifest_uri = name_or_path |
| 1607 | else: |
| 1608 | app_name = self._resolve_aliases(name_or_path) |
| 1609 | |
| 1610 | if not args.offline and not manifest_uri: |
| 1611 | try: |
| 1612 | if not self.core.login(): |
| 1613 | logger.error('Log in failed!') |
| 1614 | exit(1) |
| 1615 | except ValueError: |
| 1616 | pass |
| 1617 | |
| 1618 | # lists that will be printed or turned into JSON data |
| 1619 | info_items = dict(game=list(), manifest=list(), install=list()) |
| 1620 | InfoItem = namedtuple('InfoItem', ['name', 'json_name', 'value', 'json_value']) |
| 1621 | |
| 1622 | if self.core.is_installed(app_name): |
| 1623 | installed_platform = self.core.get_installed_game(app_name).platform |
| 1624 | if installed_platform != args.platform: |
| 1625 | logger.warning(f'Game is installed for platform "{installed_platform}", ' |
| 1626 | f'but requested metadata is for "{args.platform}", this may ' |
| 1627 | f'lead to unexpected results.') |
| 1628 | |
| 1629 | game = self.core.get_game(app_name, update_meta=not args.offline, platform=args.platform) |
| 1630 | if game and not self.core.asset_available(game, platform=args.platform): |
| 1631 | logger.warning(f'Asset information for "{game.app_name}" is missing, this may be due to the game ' |
| 1632 | f'not being available on the selected platform or currently logged-in account.') |
| 1633 | args.offline = True |
| 1634 | |
| 1635 | manifest_data = None |
| 1636 | entitlements = None |
| 1637 | # load installed manifest or URI |
| 1638 | if args.offline or manifest_uri: |
| 1639 | if app_name and self.core.is_installed(app_name): |
| 1640 | manifest_data, _ = self.core.get_installed_manifest(app_name) |
| 1641 | elif manifest_uri and manifest_uri.startswith('http'): |
| 1642 | r = self.core.egs.unauth_session.get(manifest_uri) |
| 1643 | r.raise_for_status() |
| 1644 | manifest_data = r.content |
| 1645 | elif manifest_uri and os.path.exists(manifest_uri): |
| 1646 | with open(manifest_uri, 'rb') as f: |
| 1647 | manifest_data = f.read() |
| 1648 | else: |
| 1649 | logger.info('Game not installed and offline mode enabled, cannot load manifest.') |
| 1650 | elif game: |
| 1651 | entitlements = self.core.egs.get_user_entitlements() |
| 1652 | egl_meta = self.core.egs.get_game_info(game.namespace, game.catalog_item_id) |
| 1653 | game.metadata = egl_meta |
| 1654 | # Get manifest if asset exists for current platform |
| 1655 | if args.platform in game.asset_infos: |
| 1656 | manifest_data, _ = self.core.get_cdn_manifest(game, args.platform) |
| 1657 | |
| 1658 | if game: |
| 1659 | game_infos = info_items['game'] |
no test coverage detected