manager.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:PyPlanet 作者: PyPlanet 项目源码 文件源码
def add_map(self, filename, insert=True, save_matchsettings=True):
        """
        Add or insert map to current online playlist.

        :param filename: Load from filename relative to the 'Maps' directory on the dedicated host server.
        :param insert: Insert after the current map, this will make it play directly after the current map. True by default.
        :param save_matchsettings: Save match settings as well.
        :type filename: str
        :type insert: bool
        :type save_matchsettings: bool
        :raise: pyplanet.contrib.map.exceptions.MapIncompatible
        :raise: pyplanet.contrib.map.exceptions.MapException
        """
        gbx_method = 'InsertMap' if insert else 'AddMap'

        try:
            result = await self._instance.gbx(gbx_method, filename)
        except Fault as e:
            if 'unknown' in e.faultString:
                raise MapNotFound('Map is not found on the server.')
            elif 'already' in e.faultString:
                raise MapException('Map already added to server.')
            raise MapException(e.faultString)

        # Try to save match settings.
        try:
            if save_matchsettings:
                await self.save_matchsettings()
        except Exception as e:
            handle_exception(e, __name__, 'add_map', extra_data={'EXTRAHOOK': 'Map Insert bug, see #306'})

        return result
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号