Skip to content

Commit

Permalink
⏯️ Playback Functionality (#20)
Browse files Browse the repository at this point in the history
* Bumped to `0.8.0`, Fixed confirmation cancellation, Added more unit tests

* Utilise `LazyLock` & Update Lavalink

* Implemented playback commands

* Handle player voice connection updates

* Handled unrecognised connections, track stuck & exception, fixed `/remove` index correction

* Implement response deferrals, Updated dependencies

* Fixed youtube source not working

* Use lyra-music's twilight, Optimisations & Initial playback controller development
  • Loading branch information
fdnt7 authored Sep 13, 2024
1 parent a1df0f6 commit 711cbe7
Show file tree
Hide file tree
Showing 114 changed files with 4,869 additions and 2,528 deletions.
1,013 changes: 465 additions & 548 deletions Cargo.lock

Large diffs are not rendered by default.

299 changes: 257 additions & 42 deletions flake.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@
act
sqlx-cli
pgcli
cargo-edit
];

# https://devenv.sh/scripts/
# scripts.hello.exec = "";

enterShell = ''
./scripts/get-lavalink
'';

# https://devenv.sh/tests/
Expand Down
12 changes: 8 additions & 4 deletions lavalink/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ plugins:
allowDirectPlaylistIds: true # Whether just playlist IDs can match. If false, only complete URLs will be loaded.
# The clients to use for track loading. See below for a list of valid clients.
# Clients are queried in the order they are given (left-to-right)
clients: ["MUSIC", "ANDROID", "WEB"]
clients:
- MUSIC
- ANDROID_TESTSUITE
- WEB
- TVHTML5EMBEDDED
lavasrc:
providers: # Custom providers for track loading. This is the default
- "dzisrc:%ISRC%" # Deezer ISRC provider
Expand All @@ -29,11 +33,11 @@ plugins:

lavalink:
plugins:
- dependency: "com.github.topi314.lavasrc:lavasrc-plugin:4.0.1"
- dependency: "com.github.topi314.lavasrc:lavasrc-plugin:4.2.0"
snapshot: false
- dependency: "com.github.topi314.lavasearch:lavasearch-plugin:1.0.0"
snapshot: false
- dependency: "dev.lavalink.youtube:youtube-plugin:1.1.0"
- dependency: "dev.lavalink.youtube:youtube-plugin:1.7.2"
snapshot: false
server:
sources:
Expand All @@ -43,7 +47,7 @@ lavalink:
twitch: true
vimeo: true
http: true
local: false
local: false
bufferDurationMs: 400 # The duration of the NAS buffer. Higher values fare better against longer GC pauses
frameBufferDurationMs: 5000 # How many milliseconds of audio to keep buffered
opusEncodingQuality: 10 # Opus encoder quality. Valid values range from 0 to 10, where 10 is best quality but is the most expensive on the CPU.
Expand Down
57 changes: 25 additions & 32 deletions lyra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "lyra"
readme = "../README.md"
description = "A featureful, self-hostable Discord music bot."
version = "0.7.1"
version = "0.8.0"
edition = "2021"
license = "GPL-3.0"
repository = "https://github.com/lyra-music/lyra"
Expand All @@ -11,83 +11,76 @@ build = "build.rs"

[build-dependencies]
anyhow = "1"
vergen-git2 = { version = "1.0.0-beta.2", features = [
vergen-git2 = { version = "1.0.0", features = [
"build",
"cargo",
"rustc",
"si",
] }

[lints.rust]
# dead_code = "allow"
unsafe_op_in_unsafe_fn = "forbid"
# unsafe_code = "forbid"
# dead_code = "allow"

[lints.clippy]
multiple_unsafe_ops_per_block = "forbid"
undocumented_unsafe_blocks = "forbid"
enum_glob_use = "forbid"
unwrap_used = "forbid"
try_err = "forbid"
pedantic = { level = "deny", priority = -1 }
nursery = { level = "deny", priority = -1 }

cast_possible_truncation = "allow"
cast_possible_wrap = "allow"
cast_sign_loss = "allow"
cast_precision_loss = "allow"
significant_drop_tightening = { level = "allow", priority = 1 }
module_name_repetitions = "allow"

[dependencies]
lyra_proc = { path = "../lyra_proc" }
lyra_ext = { path = "../lyra_ext" }

paste = "1.0.15"
const-str = "0.5.7"
const_panic = { version = "0.2.8", features = ["derive"] }
bitflags = "2.5.0"
dashmap = "5.5.3"
const_panic = { version = "0.2.9", features = ["derive"] }
bitflags = "2.6.0"
dashmap = "6.1.0"
dotenvy = "0.15.7"
dotenvy_macro = "0.15.7"
thiserror = "1.0.61"
thiserror = "1.0.63"
color-eyre = "0.6.3"
futures = "0.3.30"
tokio = { version = "1.38.0", features = [
tokio = { version = "1.40.0", features = [
"sync",
"signal",
"rt-multi-thread",
"macros",
] }
serde = "1.0.203"
serde_json = "1.0.117"
regex = "1.10.4"
serde = "1.0.210"
serde_json = "1.0.128"
regex = "1.10.6"
linkify = "0.10.0"
fuzzy-matcher = "0.3.7"
log = "0.4.21"
log = "0.4.22"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
rand = "0.8.5"
itertools = "0.13.0"
rayon = "1.10.0"
sqlx = { version = "0.7.4", features = ["postgres", "runtime-tokio-rustls"] }
sqlx = { version = "0.8.2", features = ["postgres", "runtime-tokio-rustls"] }
mixbox = "2.0.0"
lavalink-rs = { git = "https://gitlab.com/vicky5124/lavalink-rs", rev = "56fd9191", features = [
lavalink-rs = { git = "https://github.com/lyra-music/lavalink-rs", branch = "lyra", features = [
"twilight16",
] }
aho-corasick = "1.1.3"

twilight = "=0.16.0-rc.1"
twilight-cache-inmemory = { version = "=0.16.0-rc.1", features = [
twilight = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-cache-inmemory = { git = "https://github.com/lyra-music/twilight", branch = "lyra", features = [
"permission-calculator",
] }
twilight-gateway = "=0.16.0-rc.1"
twilight-http = "=0.16.0-rc.1"
twilight-model = "=0.16.0-rc.1"
twilight-standby = "=0.16.0-rc.1"
twilight-validate = "=0.16.0-rc.1"
twilight-mention = "=0.16.0-rc.1"
twilight-util = { version = "=0.16.0-rc.1", features = [
twilight-gateway = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-http = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-model = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-standby = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-validate = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-mention = { git = "https://github.com/lyra-music/twilight", branch = "lyra" }
twilight-util = { git = "https://github.com/lyra-music/twilight", branch = "lyra", features = [
"permission-calculator",
"builder",
] }
twilight-interactions = "0.16.0-rc.1"
twilight-interactions = { git = "https://github.com/lyra-music/twilight-interactions", branch = "lyra" }
5 changes: 2 additions & 3 deletions lyra/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ fn parse_directive(parsed: &str) -> tracing_subscriber::filter::Directive {
}

#[tracing::instrument(err)]
pub async fn run() -> Result<(), super::error::RunError> {
pub async fn run() -> Result<(), super::error::Run> {
color_eyre::install()?;
dotenvy::dotenv()?;

tracing_subscriber::fmt()
.with_env_filter(
tracing_subscriber::EnvFilter::builder()
.with_default_directive(tracing::level_filters::LevelFilter::INFO.into())
.from_env_lossy(), // .add_directive(parse_directive("lyra=trace")),
// .add_directive(parse_directive("lavalink_rs=trace")),
.from_env_lossy(),
)
.init();

Expand Down
Loading

0 comments on commit 711cbe7

Please sign in to comment.