Skip to content

Commit

Permalink
Merge pull request #82 from Polochon-street/make-album-playlist-disc
Browse files Browse the repository at this point in the history
Make album playlist disc
  • Loading branch information
Polochon-street authored Aug 12, 2024
2 parents 95d8278 + 53914b8 commit 342cf19
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 75 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## bliss 0.9.0
* Make album playlists take into account disk numbers (no more mixed disks!).
* Add a `disc_number` field in `Song`s.
* Add a mechanism to do migrations for Libraries, to make sure we're ready
for potential new features.
* Make `track_number` an integer, and not a string.
Expand Down
54 changes: 29 additions & 25 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added data/special-tags.mp3
Binary file not shown.
Binary file added data/unsupported-tags.mp3
Binary file not shown.
Binary file modified data/white_noise.mp3
Binary file not shown.
19 changes: 10 additions & 9 deletions src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1085,15 +1085,15 @@ impl<Config: AppConfigTrait, D: ?Sized + DecoderTrait> Library<Config, D> {
audio_file_path, id
from song where album = ? and analyzed = true and version = ?
order
by track_number;
by disc_number, track_number;
";

// Get the song's analysis, and attach it to the existing song.
let features_statement = "
select
feature, song.id from feature join song on song.id = feature.song_id
where album=? and analyzed = true and version = ?
order by track_number;
order by disc_number, track_number;
";
let songs = self._songs_from_statement(songs_statement, features_statement, params)?;
if songs.is_empty() {
Expand Down Expand Up @@ -1565,10 +1565,10 @@ mod test {
path: "/path/to/song2201".into(),
artist: Some("Artist2001".into()),
title: Some("Title2001".into()),
album: Some("Remixes of Album2001".into()),
album: Some("An Album2001".into()),
album_artist: Some("An Album Artist2001".into()),
track_number: Some(2),
disc_number: Some(1),
track_number: Some(1),
disc_number: Some(2),
genre: Some("Electronica2001".into()),
analysis: Analysis {
internal_analysis: analysis_vector,
Expand Down Expand Up @@ -1760,8 +1760,8 @@ mod test {
\"/path/to/charlie2001\"}', null, null
),
(
2201, '/path/to/song2201', 'Artist2001', 'Title2001', 'Remixes of Album2001',
'An Album Artist2001', 2, 1, 'Electronica2001', 410, true,
2201, '/path/to/song2201', 'Artist2001', 'Title2001', 'An Album2001',
'An Album Artist2001', 1, 2, 'Electronica2001', 410, true,
1, '{\"ignore\": false, \"metadata_bliss_does_not_have\":
\"/path/to/charlie2201\"}', null, null
),
Expand Down Expand Up @@ -2287,10 +2287,10 @@ mod test {
// First album.
"/path/to/song5001".to_string(),
"/path/to/song1001".to_string(),
// Second album, well ordered.
// Second album, well ordered, disc 1
"/path/to/song6001".to_string(),
"/path/to/song2001".to_string(),
// Seecond album, remixes
// Second album disc 2
"/path/to/song2201".to_string(),
// Third album.
"/path/to/song7001".to_string(),
Expand Down Expand Up @@ -2320,6 +2320,7 @@ mod test {
// Second album, well ordered.
"/path/to/song6001".to_string(),
"/path/to/song2001".to_string(),
"/path/to/song2201".to_string(),
],
album
.into_iter()
Expand Down
Loading

0 comments on commit 342cf19

Please sign in to comment.