summaryrefslogtreecommitdiff
path: root/src/audio
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/audio
parent482a942cd9e62fadee4ee7bc1fd7e8def8a85f71 (diff)
Bump icy-metadata to v0.1.1 and some debugging
Diffstat (limited to 'src/audio')
-rw-r--r--src/audio/rodio.rs27
1 files changed, 13 insertions, 14 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();
});