Enable fetch to apply modifications to the database #221

Merged
wojtek merged 14 commits from 189---enable-fetch-to-apply-modifications-to-the-database into main 2024-09-29 10:44:38 +02:00
Showing only changes of commit c130519adf - Show all commits

View File

@ -27,11 +27,11 @@ macro_rules! item_option_artist_set {
meta: &ArtistMeta,
) -> Result<(), musichoard::Error> {
let mut info = meta.info.clone();
info.musicbrainz = match self {
MatchOption::Some(m) => m.item.info.musicbrainz,
MatchOption::CannotHaveMbid => MbRefOption::CannotHaveMbid,
match self {
MatchOption::Some(m) => info.musicbrainz = m.item.info.musicbrainz,
MatchOption::CannotHaveMbid => info.musicbrainz = MbRefOption::CannotHaveMbid,
MatchOption::ManualInputMbid => panic!(),
};
}
music_hoard.set_artist_info(&meta.id, info)
}
}
@ -51,15 +51,11 @@ macro_rules! item_option_album_set {
meta: &AlbumMeta,
) -> Result<(), musichoard::Error> {
let mut info = meta.info.clone();
(info.musicbrainz, info.primary_type, info.secondary_types) = match self {
MatchOption::Some(m) => (
m.item.info.musicbrainz,
m.item.info.primary_type,
m.item.info.secondary_types,
),
MatchOption::CannotHaveMbid => (MbRefOption::CannotHaveMbid, None, Vec::new()),
match self {
MatchOption::Some(m) => info = m.item.info,
MatchOption::CannotHaveMbid => info.musicbrainz = MbRefOption::CannotHaveMbid,
MatchOption::ManualInputMbid => panic!(),
};
}
music_hoard.set_album_info(artist, &meta.id, info)
}
}