def install_game(self, appid): logger.debug("Installing steam game %s", appid) acf_data = get_default_acf(appid, appid) acf_content = to_vdf(acf_data) acf_path = os.path.join(self.get_game_path(), "SteamApps", "appmanifest_%s.acf" % appid) with open(acf_path, "w") as acf_file: acf_file.write(acf_content) if is_running(): shutdown() time.sleep(5) else: logger.debug("Steam not running") subprocess.Popen(["steam", "steam://preload/%s" % appid])
def install_game(self, appid): logger.debug("Installing steam game %s", appid) acf_data = get_default_acf(appid, appid) acf_content = to_vdf(acf_data) acf_path = os.path.join(self.steam_data_dir, "SteamApps", "appmanifest_%s.acf" % appid) with open(acf_path, "w") as acf_file: acf_file.write(acf_content) if is_running(): shutdown() time.sleep(5) else: logger.debug("Steam not running") subprocess.Popen(["steam", "steam://preload/%s" % appid])
def install_game(self, appid, generate_acf=False): logger.debug("Installing steam game %s", appid) if generate_acf: acf_data = get_default_acf(appid, appid) acf_content = to_vdf(acf_data) steamapps_path = self.get_default_steamapps_path() acf_path = os.path.join(steamapps_path, "appmanifest_%s.acf" % appid) with open(acf_path, "w") as acf_file: acf_file.write(acf_content) if is_running(): shutdown() time.sleep(5) command = ["steam", "steam://install/%s" % (appid)] subprocess.Popen(command)
def install_game(self, appid, generate_acf=False): logger.debug("Installing steam game %s", appid) if generate_acf: acf_data = get_default_acf(appid, appid) acf_content = to_vdf(acf_data) steamapps_path = self.get_default_steamapps_path() if not steamapps_path: raise RuntimeError('Could not find Steam path, is Steam installed?') acf_path = os.path.join(steamapps_path, "appmanifest_%s.acf" % appid) with open(acf_path, "w") as acf_file: acf_file.write(acf_content) if is_running(): shutdown() time.sleep(5) command = ["steam", "steam://install/%s" % (appid)] subprocess.Popen(command)
def test_dict_to_vdf(self): dict_data = { "AppState": { "appID": "13240", "StateFlags": "4", "UserConfig": {"name": "Unreal Tournament", "gameid": "13240"}, } } expected_vdf = """"AppState" { \t"UserConfig" \t{ \t\t"gameid"\t\t"13240" \t\t"name"\t\t"Unreal Tournament" \t} \t"StateFlags"\t\t"4" \t"appID"\t\t"13240" }""" vdf_data = steam.to_vdf(dict_data) self.assertEqual(vdf_data.strip(), expected_vdf.strip())
def test_dict_to_vdf(self): appstate = OrderedDict() userconfig = OrderedDict() userconfig['gameid'] = "13240" userconfig['name'] = "Unreal Tournament" appstate['UserConfig'] = userconfig appstate['StateFlags'] = '4' appstate['appID'] = '13240' dict_data = OrderedDict() dict_data['AppState'] = appstate expected_vdf = """"AppState" { \t"UserConfig" \t{ \t\t"gameid"\t\t"13240" \t\t"name"\t\t"Unreal Tournament" \t} \t"StateFlags"\t\t"4" \t"appID"\t\t"13240" }""" vdf_data = steam.to_vdf(dict_data) self.assertEqual(vdf_data.strip(), expected_vdf.strip())
def test_dict_to_vdf(self): dict_data = { 'AppState': { 'appID': '13240', 'StateFlags': '4', 'UserConfig': { "name": "Unreal Tournament", "gameid": "13240" } } } expected_vdf = """"AppState" { \t"UserConfig" \t{ \t\t"gameid"\t\t"13240" \t\t"name"\t\t"Unreal Tournament" \t} \t"StateFlags"\t\t"4" \t"appID"\t\t"13240" }""" vdf_data = steam.to_vdf(dict_data) self.assertEqual(vdf_data.strip(), expected_vdf.strip())