Bugfix and small changes to styling
This commit is contained in:
parent
21a17a8eb5
commit
45eb7191f0
@ -638,30 +638,37 @@ impl Album {
|
|||||||
|
|
||||||
for (album, song, artist, like, dislike) in song_list {
|
for (album, song, artist, like, dislike) in song_list {
|
||||||
if let Some(song) = song {
|
if let Some(song) = song {
|
||||||
let like_dislike = match (like, dislike) {
|
if let Some(stored_songdata) = album_songs.get_mut(&song.id.unwrap()) {
|
||||||
(Some(_), Some(_)) => Some((true, true)),
|
// If the song is already in the map, update the artists
|
||||||
(Some(_), None) => Some((true, false)),
|
if let Some(artist) = artist {
|
||||||
(None, Some(_)) => Some((false, true)),
|
stored_songdata.artists.push(artist);
|
||||||
_ => None,
|
}
|
||||||
};
|
} else {
|
||||||
|
let like_dislike = match (like, dislike) {
|
||||||
|
(Some(_), Some(_)) => Some((true, true)),
|
||||||
|
(Some(_), None) => Some((true, false)),
|
||||||
|
(None, Some(_)) => Some((false, true)),
|
||||||
|
_ => None,
|
||||||
|
};
|
||||||
|
|
||||||
let image_path = song.image_path.unwrap_or(
|
let image_path = song.image_path.unwrap_or(
|
||||||
album.image_path.clone().unwrap_or("/assets/images/placeholders/MusicPlaceholder.svg".to_string()));
|
album.image_path.clone().unwrap_or("/assets/images/placeholders/MusicPlaceholder.svg".to_string()));
|
||||||
|
|
||||||
let songdata = SongData {
|
let songdata = SongData {
|
||||||
id: song.id.unwrap(),
|
id: song.id.unwrap(),
|
||||||
title: song.title,
|
title: song.title,
|
||||||
artists: artist.map(|artist| vec![artist]).unwrap_or_default(),
|
artists: artist.map(|artist| vec![artist]).unwrap_or_default(),
|
||||||
album: Some(album),
|
album: Some(album),
|
||||||
track: song.track,
|
track: song.track,
|
||||||
duration: song.duration,
|
duration: song.duration,
|
||||||
release_date: song.release_date,
|
release_date: song.release_date,
|
||||||
song_path: song.storage_path,
|
song_path: song.storage_path,
|
||||||
image_path: image_path,
|
image_path: image_path,
|
||||||
like_dislike: like_dislike,
|
like_dislike: like_dislike,
|
||||||
};
|
};
|
||||||
|
|
||||||
album_songs.insert(song.id.unwrap(), songdata);
|
album_songs.insert(song.id.unwrap(), songdata);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
.album-artist {
|
.album-artist {
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user