Grab secondary types as well
This commit is contained in:
parent
0fe8504b8c
commit
a678609d60
8
src/external/musicbrainz/api/mod.rs
vendored
8
src/external/musicbrainz/api/mod.rs
vendored
@ -150,6 +150,7 @@ struct SearchReleaseGroup {
|
|||||||
title: String,
|
title: String,
|
||||||
first_release_date: String,
|
first_release_date: String,
|
||||||
primary_type: SerdeAlbumPrimaryType,
|
primary_type: SerdeAlbumPrimaryType,
|
||||||
|
secondary_types: Option<Vec<SerdeAlbumSecondaryType>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TryFrom<SearchReleaseGroup> for Match<Album> {
|
impl TryFrom<SearchReleaseGroup> for Match<Album> {
|
||||||
@ -160,7 +161,10 @@ impl TryFrom<SearchReleaseGroup> for Match<Album> {
|
|||||||
entity.title,
|
entity.title,
|
||||||
AlbumDate::from_mb_date(&entity.first_release_date)?,
|
AlbumDate::from_mb_date(&entity.first_release_date)?,
|
||||||
Some(entity.primary_type.into()),
|
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)
|
let mbref = MbAlbumRef::from_uuid_str(entity.id)
|
||||||
.map_err(|err| Error::MbidParse(err.to_string()))?;
|
.map_err(|err| Error::MbidParse(err.to_string()))?;
|
||||||
@ -229,7 +233,7 @@ pub enum SerdeAlbumSecondaryTypeDef {
|
|||||||
FieldRecording,
|
FieldRecording,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Clone, Debug, Deserialize)]
|
||||||
pub struct SerdeAlbumSecondaryType(
|
pub struct SerdeAlbumSecondaryType(
|
||||||
#[serde(with = "SerdeAlbumSecondaryTypeDef")] AlbumSecondaryType,
|
#[serde(with = "SerdeAlbumSecondaryTypeDef")] AlbumSecondaryType,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user