Add Readme, filter out songs with too many channels

This commit is contained in:
Jan-Henrik 2024-03-17 21:51:29 +01:00
parent 1ad44d172c
commit b862d08167
3 changed files with 30 additions and 1 deletions

25
README.md Normal file
View file

@ -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-server>:<jellyfin-port>
JELLYFIN_API_KEY: <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

View file

@ -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)
}
}

View file

@ -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(())
}