Function bliss_audio::library::analyze_paths_streaming[][src]

pub fn analyze_paths_streaming(
    paths: Vec<String>
) -> BlissResult<Receiver<(String, BlissResult<Song>)>>
Expand description

Analyze songs in paths, and return the analyzed Song objects through a Receiver.

Returns an iterable Receiver, whose items are a tuple made of the song path (to display to the user in case the analysis failed), and a Result.

Note: this is mostly useful for updating a song library, while displaying status to the user (since you have access to each song object). For the first run, you probably want to use analyze_library.

  • Example:
use bliss_audio::{library::analyze_paths_streaming, BlissResult};

fn main() -> BlissResult<()> {
    let paths = vec![String::from("/path/to/song1"), String::from("/path/to/song2")];
    let rx = analyze_paths_streaming(paths)?;
    for (path, result) in rx.iter() {
        match result {
            Ok(song) => println!("Do something with analyzed song {} with title {:?}", song.path.display(), song.title),
            Err(e) => println!("Song at {} could not be analyzed. Failed with: {}", path, e),
        }
    }
    Ok(())
}