diff --git a/Cargo.lock b/Cargo.lock index 0c44823..1a00d18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,7 +85,7 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bliss-audio" -version = "0.5.1" +version = "0.5.2" dependencies = [ "anyhow", "bliss-audio-aubio-rs", diff --git a/Cargo.toml b/Cargo.toml index 108e3e2..ddaa763 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bliss-audio" -version = "0.5.1" +version = "0.5.2" authors = ["Polochon-street "] edition = "2018" license = "GPL-3.0-only" diff --git a/src/playlist.rs b/src/playlist.rs index b3fefcb..1b7a78b 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -39,7 +39,11 @@ pub fn cosine_distance(a: &Array1, b: &Array1) -> f32 { /// Sort `songs` in place by putting songs close to `first_song` first /// using the `distance` metric. -pub fn closest_to_first_song(first_song: &Song, songs: &mut [Song], distance: impl DistanceMetric) { +pub fn closest_to_first_song( + first_song: &Song, + #[allow(clippy::ptr_arg)] songs: &mut Vec, + distance: impl DistanceMetric, +) { songs.sort_by_cached_key(|song| n32(first_song.custom_distance(song, &distance))); } @@ -115,6 +119,8 @@ pub fn dedup_playlist_custom_distance( /// songs in `group`, discarding songs that don't belong to an album. /// It basically makes an "album" playlist from the `pool` of songs. /// +/// `group` should be ordered by track number. +/// /// Songs from `group` would usually just be songs from an album, but not /// necessarily - they are discarded from `pool` no matter what. ///