Exemplo n.º 1
0
 def add_installed_games(self):
     games = []
     for steamapps_path in self.steamapps_paths:
         for appmanifest_file in get_appmanifests(steamapps_path):
             app_manifest_path = os.path.join(steamapps_path, appmanifest_file)
             self.install_from_steam(AppManifest(app_manifest_path))
     return games
Exemplo n.º 2
0
    def add_installed_games(self):
        """Syncs installed Steam games with Lutris"""
        installed_appids = []
        for steamapps_path in self.steamapps_paths:
            for appmanifest_file in get_appmanifests(steamapps_path):
                app_manifest_path = os.path.join(steamapps_path,
                                                 appmanifest_file)
                app_manifest = AppManifest(app_manifest_path)
                installed_appids.append(app_manifest.steamid)
                self.install_from_steam(app_manifest)

        db_games = get_games(filters={"runner": "steam"})
        for db_game in db_games:
            steam_game = Game(db_game["id"])
            appid = steam_game.config.game_level["game"]["appid"]
            if appid not in installed_appids:
                steam_game.remove(no_signal=True)

        db_appids = defaultdict(list)
        db_games = get_games(filters={"service": "steam"})
        for db_game in db_games:
            db_appids[db_game["service_id"]].append(db_game["id"])

        for appid in db_appids:
            game_ids = db_appids[appid]
            if len(game_ids) == 1:
                continue
            for game_id in game_ids:
                steam_game = Game(game_id)
                if not steam_game.playtime:
                    steam_game.remove(no_signal=True)
                    steam_game.delete()
Exemplo n.º 3
0
 def load(self):
     """Return importable Steam games"""
     games = []
     steamapps_paths = get_steamapps_paths()
     for steamapps_path in steamapps_paths[self.platform]:
         for appmanifest_file in get_appmanifests(steamapps_path):
             app_manifest = AppManifest(os.path.join(steamapps_path, appmanifest_file))
             if SteamGame.is_importable(app_manifest):
                 games.append(SteamGame.new_from_steam_game(app_manifest))
     return games
Exemplo n.º 4
0
 def load(self, force_reload=False):
     """Return importable Steam games"""
     games = []
     steamapps_paths = get_steamapps_paths()
     for steamapps_path in steamapps_paths[self.platform]:
         for appmanifest_file in get_appmanifests(steamapps_path):
             app_manifest = AppManifest(os.path.join(steamapps_path, appmanifest_file))
             if SteamGame.is_importable(app_manifest):
                 games.append(SteamGame.new_from_steam_game(app_manifest))
     return games
Exemplo n.º 5
0
 def print_steam_list(self, command_line):
     steamapps_paths = get_steamapps_paths()
     for path in steamapps_paths if steamapps_paths else []:
         appmanifest_files = get_appmanifests(path)
         for appmanifest_file in appmanifest_files:
             appmanifest = AppManifest(os.path.join(path, appmanifest_file))
             self._print(
                 command_line,
                 " {:8} | {:<60} | {}".format(
                     appmanifest.steamid,
                     appmanifest.name or "-",
                     ", ".join(appmanifest.states),
                 ),
             )
Exemplo n.º 6
0
 def print_steam_list(self, command_line):
     steamapps_paths = get_steamapps_paths()
     for platform in ("linux", "windows"):
         for path in steamapps_paths[platform]:
             appmanifest_files = get_appmanifests(path)
             for appmanifest_file in appmanifest_files:
                 appmanifest = AppManifest(os.path.join(path, appmanifest_file))
                 self._print(
                     command_line,
                     "  {:8} | {:<60} | {:10} | {}".format(
                         appmanifest.steamid,
                         appmanifest.name or "-",
                         platform,
                         ", ".join(appmanifest.states),
                     ),
                 )
Exemplo n.º 7
0
 def print_steam_list(self, command_line):
     steamapps_paths = get_steamapps_paths()
     for platform in ("linux", "windows"):
         for path in steamapps_paths[platform]:
             appmanifest_files = get_appmanifests(path)
             for appmanifest_file in appmanifest_files:
                 appmanifest = AppManifest(os.path.join(path, appmanifest_file))
                 self._print(
                     command_line,
                     "  {:8} | {:<60} | {:10} | {}".format(
                         appmanifest.steamid,
                         appmanifest.name or "-",
                         platform,
                         ", ".join(appmanifest.states),
                     ),
                 )
Exemplo n.º 8
0
 def load(self):
     """Return importable Steam games"""
     logger.debug("Loading Steam games from local install")
     games = []
     steamapps_paths = get_steamapps_paths()
     for platform in ('linux', 'windows'):
         for steamapps_path in steamapps_paths[platform]:
             for appmanifest_file in get_appmanifests(steamapps_path):
                 app_manifest = AppManifest(
                     os.path.join(steamapps_path, appmanifest_file))
                 if SteamGame.is_importable(app_manifest):
                     games.append(
                         SteamGame.new_from_steam_game(app_manifest))
     logger.debug("Saving Steam games...")
     for game in games:
         game.save()
     logger.debug("Steam games loaded")
     self.emit("service-games-loaded")