Beispiel #1
0
    def get_product_info(self, apps=[], packages=[], *args, **kwargs):
        resp = {'apps': {}, 'packages': {}}

        # if we have cached info for all apps, just serve from cache
        if apps and all(map(self.has_cached_appinfo, apps)):
            self._LOG.debug("Serving appinfo from cache")

            for app_id in apps:
                resp['apps'][app_id] = self.get_cached_appinfo(app_id)

            apps = []

        if apps or packages:
            self._LOG.debug("Fetching product info")
            fresh_resp = SteamClient.get_product_info(self, apps, packages,
                                                      *args, **kwargs)

            if apps:
                for app_id, appinfo in fresh_resp['apps'].items():
                    if not appinfo['_missing_token']:
                        UserCacheFile("appinfo/{}.json".format(
                            app_id)).write_json(appinfo)
                resp = fresh_resp
            else:
                resp['packages'] = fresh_resp['packages']

        return resp
Beispiel #2
0
    def _get_depot_list(self):
        """Get a list of depots for the app.

    Returns the list of depots
    """
        result = []

        client = SteamClient()
        client.anonymous_login()

        info = client.get_product_info(apps=[self.app_id])

        for depot in list(info['apps'][self.app_id]['depots']):
            # Only store depots with numeric value
            if depot.isnumeric():
                result.append(int(depot))

        return result