예제 #1
0
파일: steam.py 프로젝트: dennisjj4/lutris
 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])
예제 #2
0
파일: steam.py 프로젝트: ezeenova/lutris
 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])
예제 #3
0
파일: steam.py 프로젝트: prettyv/lutris
 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)
예제 #4
0
 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)
예제 #5
0
    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())
예제 #6
0
    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())
예제 #7
0
    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())
예제 #8
0
    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())