Example #1
0
 def get_games(self):
     """Get the config's games.
     Returns:
         list[Game]: A list of Source Engine Game objects representing the config's games.
     """
     return [Game(get_path(game.get('audio_dir', os.curdir)), game.get('audio_rate', 11025),
                  get_path(game.get('mod_path', os.curdir)), game.get('name'), game.get('play_key', 'F8'),
                  game.get('relay_key', '='), game.get('use_aliases', True)) for game in self.games]
Example #2
0
    def new(self):
        """Create a new config file.

        Returns:
            None

        """
        steam = get_steam_path()
        csgo_path = get_path(steam, 'steamapps/common/Counter-Strike Global Offensive/csgo')
        css_path = get_path(steam, 'steamapps/common/Counter-Strike Source/css')
        default = {'games':
                   [{'audio_dir': 'audio/csgo', 'use_aliases': True, 'audio_rate': 22050,
                     'name': 'Counter-Strike: Global Offensive',
                     'mod_path': csgo_path if steam != os.curdir else os.curdir,
                     'play_key': 'F8', 'relay_key': '='},
                    {'audio_dir': 'audio/css', 'use_aliases': True, 'audio_rate': 11025,
                     'name': 'Counter-Strike: Source',
                     'mod_path': css_path if steam != os.curdir else os.curdir,
                     'play_key': 'F8', 'relay_key': '='}],
                   'steam_path': steam}

        with open(self.config_file, 'w') as f:
            json.dump(default, f, indent=4, sort_keys=True)