Grab secondary types as well
Some checks failed
Cargo CI / Build and Test (pull_request) Failing after 1m26s
Cargo CI / Lint (pull_request) Failing after 1m4s

This commit is contained in:
Wojciech Kozlowski 2024-08-26 16:24:03 +02:00
parent 0fe8504b8c
commit a678609d60

View File

@ -150,6 +150,7 @@ struct SearchReleaseGroup {
title: String,
first_release_date: String,
primary_type: SerdeAlbumPrimaryType,
secondary_types: Option<Vec<SerdeAlbumSecondaryType>>,
}
impl TryFrom<SearchReleaseGroup> for Match<Album> {
@ -160,7 +161,10 @@ impl TryFrom<SearchReleaseGroup> for Match<Album> {
entity.title,
AlbumDate::from_mb_date(&entity.first_release_date)?,
Some(entity.primary_type.into()),
vec![],
entity
.secondary_types
.map(|v| v.into_iter().map(|st| st.into()).collect())
.unwrap_or_default(),
);
let mbref = MbAlbumRef::from_uuid_str(entity.id)
.map_err(|err| Error::MbidParse(err.to_string()))?;
@ -229,7 +233,7 @@ pub enum SerdeAlbumSecondaryTypeDef {
FieldRecording,
}
#[derive(Debug, Deserialize)]
#[derive(Clone, Debug, Deserialize)]
pub struct SerdeAlbumSecondaryType(
#[serde(with = "SerdeAlbumSecondaryTypeDef")] AlbumSecondaryType,
);