Trait bliss_audio::Library [−][src]
pub trait Library { fn get_songs_paths(&self) -> Result<Vec<String>, BlissError>; fn store_song(&mut self, song: &Song) -> Result<(), BlissError>; fn store_error_song(
&mut self,
song_path: String,
error: BlissError
) -> Result<(), BlissError>; fn get_stored_songs(&self) -> Result<Vec<Song>, BlissError>; fn playlist_from_song(
&self,
first_song: Song,
playlist_length: usize
) -> Result<Vec<Song>, BlissError> { ... } fn analyze_paths(&mut self, paths: Vec<String>) -> Result<(), BlissError> { ... } fn analyze_library(&mut self) -> Result<(), BlissError> { ... } }
Expand description
Library trait to make creating plug-ins for existing audio players easier.
Required methods
fn get_songs_paths(&self) -> Result<Vec<String>, BlissError>
[src]
fn get_songs_paths(&self) -> Result<Vec<String>, BlissError>
[src]Return the absolute path of all the songs in an audio player’s music library.
fn store_song(&mut self, song: &Song) -> Result<(), BlissError>
[src]
fn store_song(&mut self, song: &Song) -> Result<(), BlissError>
[src]Store an analyzed Song object in some (cold) storage, e.g. a database, a file…
fn store_error_song(
&mut self,
song_path: String,
error: BlissError
) -> Result<(), BlissError>
[src]
fn store_error_song(
&mut self,
song_path: String,
error: BlissError
) -> Result<(), BlissError>
[src]Log and / or store that an error happened while trying to decode and analyze a song.
fn get_stored_songs(&self) -> Result<Vec<Song>, BlissError>
[src]
fn get_stored_songs(&self) -> Result<Vec<Song>, BlissError>
[src]Retrieve a list of all the stored Songs.
This should work only after having run analyze_library
at least
once.
Provided methods
fn playlist_from_song(
&self,
first_song: Song,
playlist_length: usize
) -> Result<Vec<Song>, BlissError>
[src]
fn playlist_from_song(
&self,
first_song: Song,
playlist_length: usize
) -> Result<Vec<Song>, BlissError>
[src]Return a list of songs that are similar to first_song
.
Arguments
first_song
- The song the playlist will be built from.playlist_length
- The playlist length. If there are not enough songs in the library, it will be truncated to the size of the library.
Returns
A vector of playlist_length
Songs, including first_song
, that you
most likely want to plug in your audio player by using something like
ret.map(|song| song.path.to_owned()).collect::<Vec<String>>()
.
fn analyze_paths(&mut self, paths: Vec<String>) -> Result<(), BlissError>
[src]
fn analyze_paths(&mut self, paths: Vec<String>) -> Result<(), BlissError>
[src]Analyze and store songs in paths
, using store_song
and
store_error_song
implementations.
Note: this is mostly useful for updating a song library. For the first
run, you probably want to use analyze_library
.
fn analyze_library(&mut self) -> Result<(), BlissError>
[src]
fn analyze_library(&mut self) -> Result<(), BlissError>
[src]Analyzes a song library, using get_songs_paths
, store_song
and
store_error_song
implementations.