mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[Audio] Refactor internal Lavalink server management (#2495)
* Refactor internal Lavalink server management Killing many birds with one stone here. - Made server manager into class-based API with two public methods: `start()` and `shutdown()`. Must be re-instantiated each time it is restarted. - Using V3 universal Lavalink.jar hosted on Cog-Creators/Lavalink-Jars repository. - Uses output of `java -jar Lavalink.jar --version` to check if a new jar needs to be downloaded. - `ServerManager.start()` won't return until server is ready, i.e. when "Started Launcher in X seconds" message is printed to STDOUT. - `shlex.quote()` is used so spaces in path to Lavalink.jar don't cause issues. - Enabling external Lavalink will cause internal server to be terminated. - Disabling internal Lavalink will no longer reset settings in config - instead, hard-coded values will be used when connecting to an internal server. - Internal server will now run both WS and REST servers on port 2333, meaning one less port will need to be taken up. - Now using `asyncio.subprocess` module so waiting on and reading from subprocesses can be done asynchronously. Signed-off-by: Toby Harradine <tobyharradine@gmail.com> * Don't use shlex.quote on Windows Signed-off-by: Toby <tobyharradine@gmail.com> * Don't use shlex.quote at all I misread a note in the python docs and assumed it was best to use it. Turns out the note only applies to `asyncio.create_subprocess_shell`. Signed-off-by: Toby <tobyharradine@gmail.com> * Missed the port on the rebase * Ignore invalid architectures and inform users when commands are used. * Style fix
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
server:
|
||||
host: "localhost"
|
||||
port: 2333 # REST server
|
||||
lavalink:
|
||||
server:
|
||||
password: "youshallnotpass"
|
||||
ws:
|
||||
host: "localhost"
|
||||
port: 2332
|
||||
sources:
|
||||
youtube: true
|
||||
bandcamp: true
|
||||
|
||||
Reference in New Issue
Block a user