albums must have an artist + some client gui_edit changes

This commit is contained in:
Mark
2023-09-11 18:50:22 +02:00
parent c93b933037
commit a465f2be79
6 changed files with 135 additions and 197 deletions

View File

@@ -8,7 +8,7 @@ use super::{AlbumId, ArtistId, CoverId, GeneralData, SongId};
pub struct Album {
pub id: AlbumId,
pub name: String,
pub artist: Option<ArtistId>,
pub artist: ArtistId,
pub cover: Option<CoverId>,
pub songs: Vec<SongId>,
pub general: GeneralData,

View File

@@ -121,7 +121,7 @@ impl Database {
pub fn add_album_new(&mut self, album: Album) -> AlbumId {
let artist = album.artist.clone();
let id = self.add_album_new_nomagic(album);
if let Some(Some(artist)) = artist.map(|v| self.artists.get_mut(&v)) {
if let Some(artist) = self.artists.get_mut(&artist) {
artist.albums.push(id);
}
id