diff --git a/README.md b/README.md new file mode 100644 index 0000000..6316384 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# jellyfin-radio + +Ever dreamt of having your own radio station, but without the hassle of choosing the music yourself? + +jellyfin-radio randomly plays Songs from a Jellyfin collection and streams it via .mp3, which can be streamed for example on a Yamaha MusicCast System. + +The usage is rather simple. It is recommended to run this as a Docker container. An example docker-compose configuration might look like this: + +```yaml +version: "3" +services: + radio: + image: ghcr.io/jhbruhn/jellyfin-radio:main + ports: + - "3000:3000" + restart: unless-stopped + environment: + JELLYFIN_URL: http://: + JELLYFIN_API_KEY: # generated in jellyfin UI + JELLYFIN_COLLECTION_NAME: Music # name of the Collection you want to play music from + SONG_PREFETCH: 2 # optional: Define how many songs jellyfin-radio should fetch in advance +``` + +# License +MIT \ No newline at end of file diff --git a/src/jellyfin.rs b/src/jellyfin.rs index 2f0f6f7..562c09c 100644 --- a/src/jellyfin.rs +++ b/src/jellyfin.rs @@ -1,3 +1,4 @@ +use awedio::Sound; use bytes::Buf; use serde::Deserialize; @@ -154,7 +155,7 @@ impl JellyfinClient { Box::new(symphonia::core::io::ReadOnlySource::new(body.reader())), extension.as_deref(), )?); - + Ok(decoder) } } diff --git a/src/main.rs b/src/main.rs index ba72cfd..2ad886f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,6 +76,9 @@ async fn main() -> anyhow::Result<()> { println!("Fetching {} - {}", item.artists.join(","), item.name); let sound = client.fetch_audio(item).await?; println!("Fetched Song!"); + if sound.channel_count() > 2 { + anyhow::bail!("Too many channels"); + } controller.add(Box::new(sound)); anyhow::Ok(()) }