use anyhow::Result; use tracing::info; use crate::{clients::Client, dj::algorithms::Algorithm}; pub(crate) mod algorithms; pub(crate) struct Dj { algo: A, } impl Dj { pub(crate) fn new(algo: A) -> Self { Self { algo } } /// Add the next track to the playlist. /// /// This should be called after the previous track is finished, to avoid unbounded growth. pub(crate) async fn add_track(&mut self, client: &mut Client) -> Result<()> { let next = self.algo.next_track(client).await?; info!("Adding `{next}`, due to active dj mode"); client.add(&next).await?; Ok(()) } }