Merge branch 'main' of gitea:jheuel/ohrwurm
Some checks failed
tests / fmt (push) Successful in 1m56s
tests / build (push) Successful in 3m38s
tests / clippy (push) Failing after 3m51s
tests / pre-commit (push) Successful in 3m52s
tests / test (push) Successful in 4m5s
deploy / release-image (push) Has been cancelled
Some checks failed
tests / fmt (push) Successful in 1m56s
tests / build (push) Successful in 3m38s
tests / clippy (push) Failing after 3m51s
tests / pre-commit (push) Successful in 3m52s
tests / test (push) Successful in 4m5s
deploy / release-image (push) Has been cancelled
This commit is contained in:
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -1384,9 +1384,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.165"
|
version = "0.2.166"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e"
|
checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
@@ -3536,9 +3536,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-attributes"
|
name = "tracing-attributes"
|
||||||
version = "0.1.27"
|
version = "0.1.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ RUN cargo build --release --locked
|
|||||||
# Release image
|
# Release image
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
RUN apt-get update && apt-get install -y python3-pip ffmpeg
|
RUN apt-get update && apt-get install -y python3-pip
|
||||||
RUN pip install -U yt-dlp
|
RUN pip install -U yt-dlp
|
||||||
|
|
||||||
COPY --from=build /app/target/release/ohrwurm .
|
COPY --from=build /app/target/release/ohrwurm .
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ services:
|
|||||||
ohrwurm:
|
ohrwurm:
|
||||||
container_name: ohrwurm
|
container_name: ohrwurm
|
||||||
image: jheuel/ohrwurm:latest
|
image: jheuel/ohrwurm:latest
|
||||||
|
# build: .
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/data
|
- ./data:/data
|
||||||
|
|||||||
@@ -58,12 +58,18 @@ async fn get_tracks(
|
|||||||
.output()
|
.output()
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
tracing::info!(
|
||||||
|
"yt-dlp output: {:?}",
|
||||||
|
String::from_utf8_lossy(&output.stdout)
|
||||||
|
);
|
||||||
|
|
||||||
let reader = BufReader::new(output.stdout.as_slice());
|
let reader = BufReader::new(output.stdout.as_slice());
|
||||||
let tracks: Vec<YouTubeTrack> = reader
|
let tracks: Vec<YouTubeTrack> = reader
|
||||||
.lines()
|
.lines()
|
||||||
.map_while(Result::ok)
|
.map_while(Result::ok)
|
||||||
.flat_map(|line| serde_json::from_str(&line))
|
.flat_map(|line| serde_json::from_str(&line))
|
||||||
.collect();
|
.collect();
|
||||||
|
tracing::info!("yt-dlp tracks: {:?}", tracks);
|
||||||
|
|
||||||
if tracks.is_empty() {
|
if tracks.is_empty() {
|
||||||
if let Ok(stderr) = String::from_utf8(output.stderr) {
|
if let Ok(stderr) = String::from_utf8(output.stderr) {
|
||||||
@@ -76,7 +82,7 @@ async fn get_tracks(
|
|||||||
}
|
}
|
||||||
return Err("No tracks found".into());
|
return Err("No tracks found".into());
|
||||||
}
|
}
|
||||||
tracing::debug!("tracks: {:?}", tracks);
|
tracing::info!("tracks: {:?}", tracks);
|
||||||
Ok(tracks)
|
Ok(tracks)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,6 +247,11 @@ pub(crate) async fn play(
|
|||||||
state: State,
|
state: State,
|
||||||
query: String,
|
query: String,
|
||||||
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||||
|
tracing::info!(
|
||||||
|
"play command in channel {:?} by {:?}",
|
||||||
|
interaction.channel,
|
||||||
|
interaction.author(),
|
||||||
|
);
|
||||||
match play_inner(&interaction, Arc::clone(&state), query).await {
|
match play_inner(&interaction, Arc::clone(&state), query).await {
|
||||||
Ok(_) => Ok(()),
|
Ok(_) => Ok(()),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@@ -267,13 +278,14 @@ pub(crate) async fn play_inner(
|
|||||||
state: State,
|
state: State,
|
||||||
query: String,
|
query: String,
|
||||||
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||||
debug!(
|
tracing::info!(
|
||||||
"play command in channel {:?} by {:?}",
|
"play_inner in channel {:?} by {:?}",
|
||||||
interaction.channel,
|
interaction.channel,
|
||||||
interaction.author(),
|
interaction.author(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let content = format!("Adding track(s) to the queue: {}", query);
|
let content = format!("Adding track(s) to the queue: {}", query);
|
||||||
|
tracing::info!("content: {:?}", content);
|
||||||
let embeds = vec![EmbedBuilder::new()
|
let embeds = vec![EmbedBuilder::new()
|
||||||
.description(content)
|
.description(content)
|
||||||
.color(colors::YELLOW)
|
.color(colors::YELLOW)
|
||||||
@@ -308,9 +320,10 @@ pub(crate) async fn play_inner(
|
|||||||
query
|
query
|
||||||
};
|
};
|
||||||
|
|
||||||
debug!("query: {:?}", query);
|
tracing::info!("query: {:?}", query);
|
||||||
|
|
||||||
let tracks = get_tracks(query).await?;
|
let tracks = get_tracks(query).await?;
|
||||||
|
tracing::info!("got tracks: {:?}", tracks);
|
||||||
|
|
||||||
if tracks.len() > 1 {
|
if tracks.len() > 1 {
|
||||||
let first_track = tracks.first().unwrap();
|
let first_track = tracks.first().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user