litecord.voice: add LVSPManager, LVSPConnection

This commit is contained in:
Luna 2019-03-03 04:30:41 -03:00
parent 62d1252975
commit 287368ad1c
3 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,23 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
class LVSPConnection:
def __init__(self, app):
self.app = app

View File

@ -0,0 +1,27 @@
"""
Litecord
Copyright (C) 2018-2019 Luna Mendes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
class LVSPManager:
"""Manager class for Litecord Voice Server Protocol (LVSP) connections.
Spawns :class:`LVSPConnection` as needed, etc.
"""
def __init__(self, app, voice):
self.app = app
self.voice = voice

View File

@ -26,6 +26,7 @@ from logbook import Logger
from litecord.permissions import get_permissions
from litecord.enums import ChannelType, VOICE_CHANNELS
from litecord.voice.state import VoiceState
from litecord.voice.lvsp_manager import LVSPManager
VoiceKey = Tuple[int, int]
@ -47,8 +48,8 @@ class VoiceManager:
# double dict, first key is guild/channel id, second key is user id
self.states = defaultdict(dict)
self.lvsp = LVSPManager(app, self)
# TODO: hold voice server LVSP connections
# TODO: map channel ids to voice servers
async def can_join(self, user_id: int, channel_id: int) -> int: