Compare commits
3 Commits
9146ac06a6
...
a3e9175ea8
| Author | SHA1 | Date | |
|---|---|---|---|
|
a3e9175ea8
|
|||
|
6601396a88
|
|||
|
687f110416
|
8
Cargo.lock
generated
8
Cargo.lock
generated
@@ -1384,9 +1384,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.165"
|
||||
version = "0.2.166"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e"
|
||||
checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36"
|
||||
|
||||
[[package]]
|
||||
name = "libm"
|
||||
@@ -3536,9 +3536,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tracing-attributes"
|
||||
version = "0.1.27"
|
||||
version = "0.1.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
|
||||
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -20,7 +20,7 @@ RUN cargo build --release --locked
|
||||
# Release image
|
||||
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
|
||||
|
||||
COPY --from=build /app/target/release/ohrwurm .
|
||||
|
||||
@@ -2,6 +2,7 @@ services:
|
||||
ohrwurm:
|
||||
container_name: ohrwurm
|
||||
image: jheuel/ohrwurm:latest
|
||||
# build: .
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- ./data:/data
|
||||
|
||||
@@ -58,12 +58,18 @@ async fn get_tracks(
|
||||
.output()
|
||||
.await?;
|
||||
|
||||
tracing::info!(
|
||||
"yt-dlp output: {:?}",
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
);
|
||||
|
||||
let reader = BufReader::new(output.stdout.as_slice());
|
||||
let tracks: Vec<YouTubeTrack> = reader
|
||||
.lines()
|
||||
.map_while(Result::ok)
|
||||
.flat_map(|line| serde_json::from_str(&line))
|
||||
.collect();
|
||||
tracing::info!("yt-dlp tracks: {:?}", tracks);
|
||||
|
||||
if tracks.is_empty() {
|
||||
if let Ok(stderr) = String::from_utf8(output.stderr) {
|
||||
@@ -76,7 +82,7 @@ async fn get_tracks(
|
||||
}
|
||||
return Err("No tracks found".into());
|
||||
}
|
||||
tracing::debug!("tracks: {:?}", tracks);
|
||||
tracing::info!("tracks: {:?}", tracks);
|
||||
Ok(tracks)
|
||||
}
|
||||
|
||||
@@ -241,6 +247,11 @@ pub(crate) async fn play(
|
||||
state: State,
|
||||
query: String,
|
||||
) -> 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 {
|
||||
Ok(_) => Ok(()),
|
||||
Err(e) => {
|
||||
@@ -267,13 +278,14 @@ pub(crate) async fn play_inner(
|
||||
state: State,
|
||||
query: String,
|
||||
) -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
|
||||
debug!(
|
||||
"play command in channel {:?} by {:?}",
|
||||
tracing::info!(
|
||||
"play_inner in channel {:?} by {:?}",
|
||||
interaction.channel,
|
||||
interaction.author(),
|
||||
);
|
||||
|
||||
let content = format!("Adding track(s) to the queue: {}", query);
|
||||
tracing::info!("content: {:?}", content);
|
||||
let embeds = vec![EmbedBuilder::new()
|
||||
.description(content)
|
||||
.color(colors::YELLOW)
|
||||
@@ -308,9 +320,10 @@ pub(crate) async fn play_inner(
|
||||
query
|
||||
};
|
||||
|
||||
debug!("query: {:?}", query);
|
||||
tracing::info!("query: {:?}", query);
|
||||
|
||||
let tracks = get_tracks(query).await?;
|
||||
tracing::info!("got tracks: {:?}", tracks);
|
||||
|
||||
if tracks.len() > 1 {
|
||||
let first_track = tracks.first().unwrap();
|
||||
|
||||
Reference in New Issue
Block a user