summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2024-06-14 10:38:43 +0200
committerYuval Adam <_@yuv.al>2024-06-14 10:38:43 +0200
commit0a5757e76a731eaac67f87b62f3dc218fc471222 (patch)
tree7299da8b3e982d3ad1471d33350f79f990a29f36 /src
parent482a942cd9e62fadee4ee7bc1fd7e8def8a85f71 (diff)
Bump icy-metadata to v0.1.1 and some debugging
Diffstat (limited to 'src')
-rw-r--r--src/audio/rodio.rs27
-rw-r--r--src/main.rs2
2 files changed, 14 insertions, 15 deletions
diff --git a/src/audio/rodio.rs b/src/audio/rodio.rs
index 0f9fbb2..49ebe40 100644
--- a/src/audio/rodio.rs
+++ b/src/audio/rodio.rs
@@ -42,23 +42,22 @@ impl Rodio {
.await
.unwrap();
- sink.append(
- Decoder::new(IcyMetadataReader::new(
- reader,
- // Since we requested icy metadata, the metadata interval header should be present in the
- // response. This will allow us to parse the metadata within the stream
- icy_headers.metadata_interval(),
- |metadata| {
- if let Ok(md) = metadata {
- if let Some(tr) = md.stream_title() {
- println!(" {tr}");
- }
+ let metadata_reader = IcyMetadataReader::new(
+ reader,
+ // Since we requested icy metadata, the metadata interval header should be present in the
+ // response. This will allow us to parse the metadata within the stream
+ icy_headers.metadata_interval(),
+ |metadata| {
+ if let Ok(md) = metadata {
+ if let Some(tr) = md.stream_title() {
+ println!(" {tr}");
}
- },
- ))
- .unwrap(),
+ }
+ },
);
+ sink.append(Decoder::new(metadata_reader).unwrap());
+
let handle = tokio::task::spawn_blocking(move || {
sink.sleep_until_end();
});
diff --git a/src/main.rs b/src/main.rs
index 10c7d6f..5303421 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -22,7 +22,7 @@ async fn main() {
let url = get_stream_url(&playlist).await.unwrap();
sp.stop_with_newline();
- let _sp = Spinner::new(Spinners::Arrow3, format!("Playing {}", ch.title));
+ let _sp = Spinner::new(Spinners::Arrow3, format!("Playing {} at {}", ch.title, url));
audio::get_backend().play(&url).await
}
Err(_e) => {