Rename db_id to mb_ref
This commit is contained in:
parent
ccf139c2ca
commit
464e4c1014
@ -37,7 +37,7 @@ pub struct AlbumInfo {
|
|||||||
pub struct AlbumId {
|
pub struct AlbumId {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub lib_id: AlbumLibId,
|
pub lib_id: AlbumLibId,
|
||||||
pub db_id: AlbumDbId,
|
pub mb_ref: AlbumMbRef,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unique library identifier.
|
/// Unique library identifier.
|
||||||
@ -55,7 +55,7 @@ impl AlbumLibId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Unique database identifier. Use MBID for this purpose.
|
/// Unique database identifier. Use MBID for this purpose.
|
||||||
pub type AlbumDbId = MbRefOption<MbAlbumRef>;
|
pub type AlbumMbRef = MbRefOption<MbAlbumRef>;
|
||||||
|
|
||||||
impl MergeName for Album {
|
impl MergeName for Album {
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
@ -221,12 +221,12 @@ impl AlbumMeta {
|
|||||||
(&self.date, &self.seq, &self.id)
|
(&self.date, &self.seq, &self.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_db_id(&mut self, db_id: AlbumDbId) {
|
pub fn set_mb_ref(&mut self, mb_ref: AlbumMbRef) {
|
||||||
self.id.set_db_id(db_id);
|
self.id.set_mb_ref(mb_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_db_id(&mut self) {
|
pub fn clear_mb_ref(&mut self) {
|
||||||
self.id.clear_db_id();
|
self.id.clear_mb_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_seq(&mut self, seq: AlbumSeq) {
|
pub fn set_seq(&mut self, seq: AlbumSeq) {
|
||||||
@ -265,7 +265,7 @@ impl Ord for AlbumMeta {
|
|||||||
impl Merge for AlbumMeta {
|
impl Merge for AlbumMeta {
|
||||||
fn merge_in_place(&mut self, other: Self) {
|
fn merge_in_place(&mut self, other: Self) {
|
||||||
assert!(self.id.compatible(&other.id));
|
assert!(self.id.compatible(&other.id));
|
||||||
self.id.db_id = self.id.db_id.take().or(other.id.db_id);
|
self.id.mb_ref = self.id.mb_ref.take().or(other.id.mb_ref);
|
||||||
self.seq = std::cmp::max(self.seq, other.seq);
|
self.seq = std::cmp::max(self.seq, other.seq);
|
||||||
self.info.merge_in_place(other.info);
|
self.info.merge_in_place(other.info);
|
||||||
}
|
}
|
||||||
@ -297,30 +297,30 @@ impl AlbumId {
|
|||||||
AlbumId {
|
AlbumId {
|
||||||
title: name.into(),
|
title: name.into(),
|
||||||
lib_id: AlbumLibId::None,
|
lib_id: AlbumLibId::None,
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_db_id(mut self, db_id: AlbumDbId) -> Self {
|
pub fn with_mb_ref(mut self, mb_ref: AlbumMbRef) -> Self {
|
||||||
self.db_id = db_id;
|
self.mb_ref = mb_ref;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_db_id(&mut self, db_id: AlbumDbId) {
|
pub fn set_mb_ref(&mut self, mb_ref: AlbumMbRef) {
|
||||||
self.db_id = db_id;
|
self.mb_ref = mb_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_db_id(&mut self) {
|
pub fn clear_mb_ref(&mut self) {
|
||||||
self.db_id.take();
|
self.mb_ref.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compatible(&self, other: &AlbumId) -> bool {
|
pub fn compatible(&self, other: &AlbumId) -> bool {
|
||||||
let titles_compatible = self.title == other.title;
|
let titles_compatible = self.title == other.title;
|
||||||
let lib_id_compatible =
|
let lib_id_compatible =
|
||||||
self.lib_id.is_none() || other.lib_id.is_none() || (self.lib_id == other.lib_id);
|
self.lib_id.is_none() || other.lib_id.is_none() || (self.lib_id == other.lib_id);
|
||||||
let db_id_compatible =
|
let mb_ref_compatible =
|
||||||
self.db_id.is_none() || other.db_id.is_none() || (self.db_id == other.db_id);
|
self.mb_ref.is_none() || other.mb_ref.is_none() || (self.mb_ref == other.mb_ref);
|
||||||
titles_compatible && lib_id_compatible && db_id_compatible
|
titles_compatible && lib_id_compatible && mb_ref_compatible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,11 @@ impl MergeName for Artist {
|
|||||||
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct ArtistId {
|
pub struct ArtistId {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub db_id: ArtistDbId,
|
pub mb_ref: ArtistMbRef,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Unique database identifier. Use MBID for this purpose.
|
/// Unique database identifier. Use MBID for this purpose.
|
||||||
pub type ArtistDbId = MbRefOption<MbArtistRef>;
|
pub type ArtistMbRef = MbRefOption<MbArtistRef>;
|
||||||
|
|
||||||
impl Artist {
|
impl Artist {
|
||||||
/// Create new [`Artist`] with the given [`ArtistId`].
|
/// Create new [`Artist`] with the given [`ArtistId`].
|
||||||
@ -120,12 +120,12 @@ impl ArtistMeta {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_db_id(&mut self, db_id: ArtistDbId) {
|
pub fn set_mb_ref(&mut self, mb_ref: ArtistMbRef) {
|
||||||
self.id.set_db_id(db_id);
|
self.id.set_mb_ref(mb_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_db_id(&mut self) {
|
pub fn clear_mb_ref(&mut self) {
|
||||||
self.id.clear_db_id();
|
self.id.clear_mb_ref();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_sort_key(&self) -> (&str,) {
|
pub fn get_sort_key(&self) -> (&str,) {
|
||||||
@ -202,7 +202,7 @@ impl Ord for ArtistMeta {
|
|||||||
impl Merge for ArtistMeta {
|
impl Merge for ArtistMeta {
|
||||||
fn merge_in_place(&mut self, other: Self) {
|
fn merge_in_place(&mut self, other: Self) {
|
||||||
assert!(self.id.compatible(&other.id));
|
assert!(self.id.compatible(&other.id));
|
||||||
self.id.db_id = self.id.db_id.take().or(other.id.db_id);
|
self.id.mb_ref = self.id.mb_ref.take().or(other.id.mb_ref);
|
||||||
self.sort = self.sort.take().or(other.sort);
|
self.sort = self.sort.take().or(other.sort);
|
||||||
self.info.merge_in_place(other.info);
|
self.info.merge_in_place(other.info);
|
||||||
}
|
}
|
||||||
@ -230,28 +230,28 @@ impl ArtistId {
|
|||||||
pub fn new<S: Into<String>>(name: S) -> ArtistId {
|
pub fn new<S: Into<String>>(name: S) -> ArtistId {
|
||||||
ArtistId {
|
ArtistId {
|
||||||
name: name.into(),
|
name: name.into(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn with_db_id(mut self, db_id: ArtistDbId) -> Self {
|
pub fn with_mb_ref(mut self, mb_ref: ArtistMbRef) -> Self {
|
||||||
self.db_id = db_id;
|
self.mb_ref = mb_ref;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_db_id(&mut self, db_id: ArtistDbId) {
|
pub fn set_mb_ref(&mut self, mb_ref: ArtistMbRef) {
|
||||||
self.db_id = db_id;
|
self.mb_ref = mb_ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear_db_id(&mut self) {
|
pub fn clear_mb_ref(&mut self) {
|
||||||
self.db_id.take();
|
self.mb_ref.take();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compatible(&self, other: &ArtistId) -> bool {
|
pub fn compatible(&self, other: &ArtistId) -> bool {
|
||||||
let names_compatible = self.name == other.name;
|
let names_compatible = self.name == other.name;
|
||||||
let db_id_compatible =
|
let mb_ref_compatible =
|
||||||
self.db_id.is_none() || other.db_id.is_none() || (self.db_id == other.db_id);
|
self.mb_ref.is_none() || other.mb_ref.is_none() || (self.mb_ref == other.mb_ref);
|
||||||
names_compatible && db_id_compatible
|
names_compatible && mb_ref_compatible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,30 +326,30 @@ mod tests {
|
|||||||
let mut artist = Artist::new(ArtistId::new("an artist"));
|
let mut artist = Artist::new(ArtistId::new("an artist"));
|
||||||
|
|
||||||
let mut expected: MbRefOption<MbArtistRef> = MbRefOption::None;
|
let mut expected: MbRefOption<MbArtistRef> = MbRefOption::None;
|
||||||
assert_eq!(artist.meta.id.db_id, expected);
|
assert_eq!(artist.meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Setting a URL on an artist.
|
// Setting a URL on an artist.
|
||||||
artist.meta.id.set_db_id(MbRefOption::Some(
|
artist.meta.id.set_mb_ref(MbRefOption::Some(
|
||||||
MbArtistRef::from_url_str(MUSICBRAINZ).unwrap(),
|
MbArtistRef::from_url_str(MUSICBRAINZ).unwrap(),
|
||||||
));
|
));
|
||||||
expected.replace(MbArtistRef::from_url_str(MUSICBRAINZ).unwrap());
|
expected.replace(MbArtistRef::from_url_str(MUSICBRAINZ).unwrap());
|
||||||
assert_eq!(artist.meta.id.db_id, expected);
|
assert_eq!(artist.meta.id.mb_ref, expected);
|
||||||
|
|
||||||
artist.meta.id.set_db_id(MbRefOption::Some(
|
artist.meta.id.set_mb_ref(MbRefOption::Some(
|
||||||
MbArtistRef::from_url_str(MUSICBRAINZ).unwrap(),
|
MbArtistRef::from_url_str(MUSICBRAINZ).unwrap(),
|
||||||
));
|
));
|
||||||
assert_eq!(artist.meta.id.db_id, expected);
|
assert_eq!(artist.meta.id.mb_ref, expected);
|
||||||
|
|
||||||
artist.meta.id.set_db_id(MbRefOption::Some(
|
artist.meta.id.set_mb_ref(MbRefOption::Some(
|
||||||
MbArtistRef::from_url_str(MUSICBRAINZ_2).unwrap(),
|
MbArtistRef::from_url_str(MUSICBRAINZ_2).unwrap(),
|
||||||
));
|
));
|
||||||
expected.replace(MbArtistRef::from_url_str(MUSICBRAINZ_2).unwrap());
|
expected.replace(MbArtistRef::from_url_str(MUSICBRAINZ_2).unwrap());
|
||||||
assert_eq!(artist.meta.id.db_id, expected);
|
assert_eq!(artist.meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Clearing URLs.
|
// Clearing URLs.
|
||||||
artist.meta.id.clear_db_id();
|
artist.meta.id.clear_mb_ref();
|
||||||
expected.take();
|
expected.take();
|
||||||
assert_eq!(artist.meta.id.db_id, expected);
|
assert_eq!(artist.meta.id.mb_ref, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -465,7 +465,7 @@ mod tests {
|
|||||||
let left = FULL_COLLECTION[0].to_owned();
|
let left = FULL_COLLECTION[0].to_owned();
|
||||||
let mut right = FULL_COLLECTION[1].to_owned();
|
let mut right = FULL_COLLECTION[1].to_owned();
|
||||||
right.meta.id = left.meta.id.clone();
|
right.meta.id = left.meta.id.clone();
|
||||||
right.meta.id.db_id = MbRefOption::None;
|
right.meta.id.mb_ref = MbRefOption::None;
|
||||||
right.meta.info.properties = HashMap::new();
|
right.meta.info.properties = HashMap::new();
|
||||||
|
|
||||||
let mut expected = left.clone();
|
let mut expected = left.clone();
|
||||||
|
@ -2,8 +2,8 @@ use std::mem;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
collection::{
|
collection::{
|
||||||
album::{AlbumDbId, AlbumInfo, AlbumMeta},
|
album::{AlbumInfo, AlbumMbRef, AlbumMeta},
|
||||||
artist::{ArtistDbId, ArtistInfo},
|
artist::{ArtistInfo, ArtistMbRef},
|
||||||
merge::Merge,
|
merge::Merge,
|
||||||
},
|
},
|
||||||
core::{
|
core::{
|
||||||
@ -23,12 +23,12 @@ pub trait IMusicHoardDatabase {
|
|||||||
fn add_artist<IntoId: Into<ArtistId>>(&mut self, artist_id: IntoId) -> Result<(), Error>;
|
fn add_artist<IntoId: Into<ArtistId>>(&mut self, artist_id: IntoId) -> Result<(), Error>;
|
||||||
fn remove_artist<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error>;
|
fn remove_artist<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error>;
|
||||||
|
|
||||||
fn set_artist_db_id<Id: AsRef<ArtistId>>(
|
fn set_artist_mb_ref<Id: AsRef<ArtistId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: Id,
|
artist_id: Id,
|
||||||
db_id: ArtistDbId,
|
mb_ref: ArtistMbRef,
|
||||||
) -> Result<(), Error>;
|
) -> Result<(), Error>;
|
||||||
fn clear_artist_db_id<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error>;
|
fn clear_artist_mb_ref<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error>;
|
||||||
|
|
||||||
fn set_artist_sort<Id: AsRef<ArtistId>, S: Into<String>>(
|
fn set_artist_sort<Id: AsRef<ArtistId>, S: Into<String>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -79,13 +79,13 @@ pub trait IMusicHoardDatabase {
|
|||||||
album_id: AlbumIdRef,
|
album_id: AlbumIdRef,
|
||||||
) -> Result<(), Error>;
|
) -> Result<(), Error>;
|
||||||
|
|
||||||
fn set_album_db_id<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
fn set_album_mb_ref<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: ArtistIdRef,
|
artist_id: ArtistIdRef,
|
||||||
album_id: AlbumIdRef,
|
album_id: AlbumIdRef,
|
||||||
db_id: AlbumDbId,
|
mb_ref: AlbumMbRef,
|
||||||
) -> Result<(), Error>;
|
) -> Result<(), Error>;
|
||||||
fn clear_album_db_id<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
fn clear_album_mb_ref<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: ArtistIdRef,
|
artist_id: ArtistIdRef,
|
||||||
album_id: AlbumIdRef,
|
album_id: AlbumIdRef,
|
||||||
@ -147,22 +147,22 @@ impl<Database: IDatabase, Library> IMusicHoardDatabase for MusicHoard<Database,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_artist_db_id<Id: AsRef<ArtistId>>(
|
fn set_artist_mb_ref<Id: AsRef<ArtistId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: Id,
|
artist_id: Id,
|
||||||
db_id: ArtistDbId,
|
mb_ref: ArtistMbRef,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
self.update_artist_and(
|
self.update_artist_and(
|
||||||
artist_id.as_ref(),
|
artist_id.as_ref(),
|
||||||
|artist| artist.meta.set_db_id(db_id),
|
|artist| artist.meta.set_mb_ref(mb_ref),
|
||||||
|collection| Self::sort_artists(collection),
|
|collection| Self::sort_artists(collection),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clear_artist_db_id<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error> {
|
fn clear_artist_mb_ref<Id: AsRef<ArtistId>>(&mut self, artist_id: Id) -> Result<(), Error> {
|
||||||
self.update_artist_and(
|
self.update_artist_and(
|
||||||
artist_id.as_ref(),
|
artist_id.as_ref(),
|
||||||
|artist| artist.meta.clear_db_id(),
|
|artist| artist.meta.clear_mb_ref(),
|
||||||
|collection| Self::sort_artists(collection),
|
|collection| Self::sort_artists(collection),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -280,21 +280,21 @@ impl<Database: IDatabase, Library> IMusicHoardDatabase for MusicHoard<Database,
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_album_db_id<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
fn set_album_mb_ref<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: ArtistIdRef,
|
artist_id: ArtistIdRef,
|
||||||
album_id: AlbumIdRef,
|
album_id: AlbumIdRef,
|
||||||
db_id: AlbumDbId,
|
mb_ref: AlbumMbRef,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
self.update_album_and(
|
self.update_album_and(
|
||||||
artist_id.as_ref(),
|
artist_id.as_ref(),
|
||||||
album_id.as_ref(),
|
album_id.as_ref(),
|
||||||
|album| album.meta.set_db_id(db_id),
|
|album| album.meta.set_mb_ref(mb_ref),
|
||||||
|artist| artist.albums.sort_unstable(),
|
|artist| artist.albums.sort_unstable(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn clear_album_db_id<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
fn clear_album_mb_ref<ArtistIdRef: AsRef<ArtistId>, AlbumIdRef: AsRef<AlbumId>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: ArtistIdRef,
|
artist_id: ArtistIdRef,
|
||||||
album_id: AlbumIdRef,
|
album_id: AlbumIdRef,
|
||||||
@ -302,7 +302,7 @@ impl<Database: IDatabase, Library> IMusicHoardDatabase for MusicHoard<Database,
|
|||||||
self.update_album_and(
|
self.update_album_and(
|
||||||
artist_id.as_ref(),
|
artist_id.as_ref(),
|
||||||
album_id.as_ref(),
|
album_id.as_ref(),
|
||||||
|album| album.meta.clear_db_id(),
|
|album| album.meta.clear_mb_ref(),
|
||||||
|artist| artist.albums.sort_unstable(),
|
|artist| artist.albums.sort_unstable(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -585,7 +585,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_clear_artist_db_id() {
|
fn set_clear_artist_mb_ref() {
|
||||||
let mut database = MockIDatabase::new();
|
let mut database = MockIDatabase::new();
|
||||||
database.expect_load().times(1).returning(|| Ok(vec![]));
|
database.expect_load().times(1).returning(|| Ok(vec![]));
|
||||||
database.expect_save().times(3).returning(|_| Ok(()));
|
database.expect_save().times(3).returning(|_| Ok(()));
|
||||||
@ -596,38 +596,38 @@ mod tests {
|
|||||||
|
|
||||||
assert!(music_hoard.add_artist(artist_id.clone()).is_ok());
|
assert!(music_hoard.add_artist(artist_id.clone()).is_ok());
|
||||||
|
|
||||||
let mut expected = ArtistDbId::None;
|
let mut expected = ArtistMbRef::None;
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
|
|
||||||
let db_id = ArtistDbId::Some(MbArtistRef::from_uuid_str(MBID).unwrap());
|
let mb_ref = ArtistMbRef::Some(MbArtistRef::from_uuid_str(MBID).unwrap());
|
||||||
|
|
||||||
// Setting a db_id on an artist not in the collection is an error.
|
// Setting a mb_ref on an artist not in the collection is an error.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.set_artist_db_id(&artist_id_2, db_id.clone())
|
.set_artist_mb_ref(&artist_id_2, mb_ref.clone())
|
||||||
.is_err());
|
.is_err());
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Setting a db_id on an artist.
|
// Setting a mb_ref on an artist.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.set_artist_db_id(&artist_id, db_id.clone())
|
.set_artist_mb_ref(&artist_id, mb_ref.clone())
|
||||||
.is_ok());
|
.is_ok());
|
||||||
expected.replace(MbArtistRef::from_uuid_str(MBID).unwrap());
|
expected.replace(MbArtistRef::from_uuid_str(MBID).unwrap());
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Clearing db_id on an artist that does not exist is an error.
|
// Clearing mb_ref on an artist that does not exist is an error.
|
||||||
assert!(music_hoard.clear_artist_db_id(&artist_id_2).is_err());
|
assert!(music_hoard.clear_artist_mb_ref(&artist_id_2).is_err());
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Clearing db_id from an artist without the db_id set is an error. Effectively the album
|
// Clearing mb_ref from an artist without the mb_ref set is an error. Effectively the album
|
||||||
// does not exist.
|
// does not exist.
|
||||||
assert!(music_hoard.clear_artist_db_id(&artist_id).is_err());
|
assert!(music_hoard.clear_artist_mb_ref(&artist_id).is_err());
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
|
|
||||||
// Clearing db_id.
|
// Clearing mb_ref.
|
||||||
artist_id.set_db_id(db_id);
|
artist_id.set_mb_ref(mb_ref);
|
||||||
assert!(music_hoard.clear_artist_db_id(&artist_id).is_ok());
|
assert!(music_hoard.clear_artist_mb_ref(&artist_id).is_ok());
|
||||||
expected.take();
|
expected.take();
|
||||||
assert_eq!(music_hoard.collection[0].meta.id.db_id, expected);
|
assert_eq!(music_hoard.collection[0].meta.id.mb_ref, expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@ -824,7 +824,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn set_clear_album_db_id() {
|
fn set_clear_album_mb_ref() {
|
||||||
let mut database = MockIDatabase::new();
|
let mut database = MockIDatabase::new();
|
||||||
|
|
||||||
let artist_id = ArtistId::new("an artist");
|
let artist_id = ArtistId::new("an artist");
|
||||||
@ -842,40 +842,40 @@ mod tests {
|
|||||||
|
|
||||||
let mut music_hoard = MusicHoard::database(database).unwrap();
|
let mut music_hoard = MusicHoard::database(database).unwrap();
|
||||||
let album = &music_hoard.collection[0].albums[0];
|
let album = &music_hoard.collection[0].albums[0];
|
||||||
assert_eq!(album.meta.id.db_id, AlbumDbId::None);
|
assert_eq!(album.meta.id.mb_ref, AlbumMbRef::None);
|
||||||
|
|
||||||
// Seting db_id on an album not belonging to the artist is an error.
|
// Seting mb_ref on an album not belonging to the artist is an error.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.set_album_db_id(&artist_id, &album_id_2, AlbumDbId::CannotHaveMbid)
|
.set_album_mb_ref(&artist_id, &album_id_2, AlbumMbRef::CannotHaveMbid)
|
||||||
.is_err());
|
.is_err());
|
||||||
let album = &music_hoard.collection[0].albums[0];
|
let album = &music_hoard.collection[0].albums[0];
|
||||||
assert_eq!(album.meta.id.db_id, AlbumDbId::None);
|
assert_eq!(album.meta.id.mb_ref, AlbumMbRef::None);
|
||||||
|
|
||||||
// Set db_id.
|
// Set mb_ref.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.set_album_db_id(&artist_id, &album_id, AlbumDbId::CannotHaveMbid)
|
.set_album_mb_ref(&artist_id, &album_id, AlbumMbRef::CannotHaveMbid)
|
||||||
.is_ok());
|
.is_ok());
|
||||||
let album = &music_hoard.collection[0].albums[0];
|
let album = &music_hoard.collection[0].albums[0];
|
||||||
assert_eq!(album.meta.id.db_id, AlbumDbId::CannotHaveMbid);
|
assert_eq!(album.meta.id.mb_ref, AlbumMbRef::CannotHaveMbid);
|
||||||
|
|
||||||
// Clearing db_id on an album that does not exist is an error.
|
// Clearing mb_ref on an album that does not exist is an error.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.clear_album_db_id(&artist_id, &album_id_2)
|
.clear_album_mb_ref(&artist_id, &album_id_2)
|
||||||
.is_err());
|
.is_err());
|
||||||
|
|
||||||
// Clearing db_id from an album without the db_id set is an error. Effectively the album
|
// Clearing mb_ref from an album without the mb_ref set is an error. Effectively the album
|
||||||
// does not exist.
|
// does not exist.
|
||||||
assert!(music_hoard
|
assert!(music_hoard
|
||||||
.clear_album_db_id(&artist_id, &album_id)
|
.clear_album_mb_ref(&artist_id, &album_id)
|
||||||
.is_err());
|
.is_err());
|
||||||
let album = &music_hoard.collection[0].albums[0];
|
let album = &music_hoard.collection[0].albums[0];
|
||||||
assert_eq!(album.meta.id.db_id, AlbumDbId::CannotHaveMbid);
|
assert_eq!(album.meta.id.mb_ref, AlbumMbRef::CannotHaveMbid);
|
||||||
|
|
||||||
// To clear the db_id we need the album_id to have the db_id to identify the correct album.
|
// To clear the mb_ref we need the album_id to have the mb_ref to identify the correct album.
|
||||||
album_id.set_db_id(AlbumDbId::CannotHaveMbid);
|
album_id.set_mb_ref(AlbumMbRef::CannotHaveMbid);
|
||||||
assert!(music_hoard.clear_album_db_id(&artist_id, &album_id).is_ok());
|
assert!(music_hoard.clear_album_mb_ref(&artist_id, &album_id).is_ok());
|
||||||
let album = &music_hoard.collection[0].albums[0];
|
let album = &music_hoard.collection[0].albums[0];
|
||||||
assert_eq!(album.meta.id.db_id, AlbumDbId::None);
|
assert_eq!(album.meta.id.mb_ref, AlbumMbRef::None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use crate::{
|
use crate::core::{
|
||||||
collection::{album::AlbumDbId, artist::ArtistDbId},
|
|
||||||
core::{
|
|
||||||
collection::{
|
collection::{
|
||||||
album::{Album, AlbumDate, AlbumId},
|
album::{Album, AlbumDate, AlbumId, AlbumMbRef},
|
||||||
artist::{Artist, ArtistId},
|
artist::{Artist, ArtistId, ArtistMbRef},
|
||||||
track::{Track, TrackId, TrackNum, TrackQuality},
|
track::{Track, TrackId, TrackNum, TrackQuality},
|
||||||
Collection,
|
Collection,
|
||||||
},
|
},
|
||||||
@ -17,7 +15,6 @@ use crate::{
|
|||||||
base::IMusicHoardBasePrivate, database::IMusicHoardDatabasePrivate, Error, MusicHoard,
|
base::IMusicHoardBasePrivate, database::IMusicHoardDatabasePrivate, Error, MusicHoard,
|
||||||
NoDatabase,
|
NoDatabase,
|
||||||
},
|
},
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub trait IMusicHoardLibrary {
|
pub trait IMusicHoardLibrary {
|
||||||
@ -53,7 +50,7 @@ impl<Database, Library: ILibrary> MusicHoard<Database, Library> {
|
|||||||
for item in items.into_iter() {
|
for item in items.into_iter() {
|
||||||
let artist_id = ArtistId {
|
let artist_id = ArtistId {
|
||||||
name: item.album_artist,
|
name: item.album_artist,
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let artist_sort = item.album_artist_sort;
|
let artist_sort = item.album_artist_sort;
|
||||||
@ -61,7 +58,7 @@ impl<Database, Library: ILibrary> MusicHoard<Database, Library> {
|
|||||||
let album_id = AlbumId {
|
let album_id = AlbumId {
|
||||||
title: item.album_title,
|
title: item.album_title,
|
||||||
lib_id: item.album_lib_id,
|
lib_id: item.album_lib_id,
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let album_date = AlbumDate {
|
let album_date = AlbumDate {
|
||||||
|
@ -3,9 +3,9 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use crate::core::collection::{
|
use crate::core::collection::{
|
||||||
album::{
|
album::{
|
||||||
Album, AlbumDbId, AlbumId, AlbumInfo, AlbumLibId, AlbumMeta, AlbumPrimaryType, AlbumSeq,
|
Album, AlbumId, AlbumInfo, AlbumLibId, AlbumMbRef, AlbumMeta, AlbumPrimaryType, AlbumSeq,
|
||||||
},
|
},
|
||||||
artist::{Artist, ArtistDbId, ArtistId, ArtistInfo, ArtistMeta},
|
artist::{Artist, ArtistId, ArtistInfo, ArtistMbRef, ArtistMeta},
|
||||||
musicbrainz::{MbAlbumRef, MbArtistRef},
|
musicbrainz::{MbAlbumRef, MbArtistRef},
|
||||||
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
||||||
};
|
};
|
||||||
|
@ -125,7 +125,7 @@ impl From<DeserializeArtist> for Artist {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: artist.name,
|
name: artist.name,
|
||||||
db_id: artist.musicbrainz.into(),
|
mb_ref: artist.musicbrainz.into(),
|
||||||
},
|
},
|
||||||
sort: artist.sort,
|
sort: artist.sort,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -144,7 +144,7 @@ impl From<DeserializeAlbum> for Album {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: album.title,
|
title: album.title,
|
||||||
lib_id: album.lib_id.into(),
|
lib_id: album.lib_id.into(),
|
||||||
db_id: album.musicbrainz.into(),
|
mb_ref: album.musicbrainz.into(),
|
||||||
},
|
},
|
||||||
date: AlbumDate::default(),
|
date: AlbumDate::default(),
|
||||||
seq: AlbumSeq(album.seq),
|
seq: AlbumSeq(album.seq),
|
||||||
|
@ -86,7 +86,7 @@ impl<'a> From<&'a Artist> for SerializeArtist<'a> {
|
|||||||
SerializeArtist {
|
SerializeArtist {
|
||||||
name: &artist.meta.id.name,
|
name: &artist.meta.id.name,
|
||||||
sort: artist.meta.sort.as_deref(),
|
sort: artist.meta.sort.as_deref(),
|
||||||
musicbrainz: (&artist.meta.id.db_id).into(),
|
musicbrainz: (&artist.meta.id.mb_ref).into(),
|
||||||
properties: artist
|
properties: artist
|
||||||
.meta
|
.meta
|
||||||
.info
|
.info
|
||||||
@ -105,7 +105,7 @@ impl<'a> From<&'a Album> for SerializeAlbum<'a> {
|
|||||||
title: &album.meta.id.title,
|
title: &album.meta.id.title,
|
||||||
lib_id: album.meta.id.lib_id.into(),
|
lib_id: album.meta.id.lib_id.into(),
|
||||||
seq: album.meta.seq.0,
|
seq: album.meta.seq.0,
|
||||||
musicbrainz: (&album.meta.id.db_id).into(),
|
musicbrainz: (&album.meta.id.mb_ref).into(),
|
||||||
primary_type: album.meta.info.primary_type.map(Into::into),
|
primary_type: album.meta.info.primary_type.map(Into::into),
|
||||||
secondary_types: album
|
secondary_types: album
|
||||||
.meta
|
.meta
|
||||||
|
@ -5,7 +5,7 @@ macro_rules! full_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘A’".to_string(),
|
name: "Album_Artist ‘A’".to_string(),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/00000000-0000-0000-0000-000000000000"
|
"https://musicbrainz.org/artist/00000000-0000-0000-0000-000000000000"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -29,7 +29,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title a.a".to_string(),
|
title: "album_title a.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(1),
|
lib_id: AlbumLibId::Value(1),
|
||||||
db_id: AlbumDbId::Some(MbAlbumRef::from_url_str(
|
mb_ref: AlbumMbRef::Some(MbAlbumRef::from_url_str(
|
||||||
"https://musicbrainz.org/release-group/00000000-0000-0000-0000-000000000000"
|
"https://musicbrainz.org/release-group/00000000-0000-0000-0000-000000000000"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -95,7 +95,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title a.b".to_string(),
|
title: "album_title a.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(2),
|
lib_id: AlbumLibId::Value(2),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: (2015, 4).into(),
|
date: (2015, 4).into(),
|
||||||
seq: AlbumSeq(1),
|
seq: AlbumSeq(1),
|
||||||
@ -135,7 +135,7 @@ macro_rules! full_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘B’".to_string(),
|
name: "Album_Artist ‘B’".to_string(),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/11111111-1111-1111-1111-111111111111"
|
"https://musicbrainz.org/artist/11111111-1111-1111-1111-111111111111"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -163,7 +163,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.a".to_string(),
|
title: "album_title b.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(3),
|
lib_id: AlbumLibId::Value(3),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: (2003, 6, 6).into(),
|
date: (2003, 6, 6).into(),
|
||||||
seq: AlbumSeq(1),
|
seq: AlbumSeq(1),
|
||||||
@ -205,7 +205,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.b".to_string(),
|
title: "album_title b.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(4),
|
lib_id: AlbumLibId::Value(4),
|
||||||
db_id: AlbumDbId::Some(MbAlbumRef::from_url_str(
|
mb_ref: AlbumMbRef::Some(MbAlbumRef::from_url_str(
|
||||||
"https://musicbrainz.org/release-group/11111111-1111-1111-1111-111111111111"
|
"https://musicbrainz.org/release-group/11111111-1111-1111-1111-111111111111"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -249,7 +249,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.c".to_string(),
|
title: "album_title b.c".to_string(),
|
||||||
lib_id: AlbumLibId::Value(5),
|
lib_id: AlbumLibId::Value(5),
|
||||||
db_id: AlbumDbId::Some(MbAlbumRef::from_url_str(
|
mb_ref: AlbumMbRef::Some(MbAlbumRef::from_url_str(
|
||||||
"https://musicbrainz.org/release-group/11111111-1111-1111-1111-111111111112"
|
"https://musicbrainz.org/release-group/11111111-1111-1111-1111-111111111112"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -293,7 +293,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.d".to_string(),
|
title: "album_title b.d".to_string(),
|
||||||
lib_id: AlbumLibId::Value(6),
|
lib_id: AlbumLibId::Value(6),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2015.into(),
|
date: 2015.into(),
|
||||||
seq: AlbumSeq(4),
|
seq: AlbumSeq(4),
|
||||||
@ -336,7 +336,7 @@ macro_rules! full_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "The Album_Artist ‘C’".to_string(),
|
name: "The Album_Artist ‘C’".to_string(),
|
||||||
db_id: ArtistDbId::CannotHaveMbid,
|
mb_ref: ArtistMbRef::CannotHaveMbid,
|
||||||
},
|
},
|
||||||
sort: Some("Album_Artist ‘C’, The".to_string()),
|
sort: Some("Album_Artist ‘C’, The".to_string()),
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -349,7 +349,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title c.a".to_string(),
|
title: "album_title c.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(7),
|
lib_id: AlbumLibId::Value(7),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1985.into(),
|
date: 1985.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -391,7 +391,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title c.b".to_string(),
|
title: "album_title c.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(8),
|
lib_id: AlbumLibId::Value(8),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2018.into(),
|
date: 2018.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -434,7 +434,7 @@ macro_rules! full_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘D’".to_string(),
|
name: "Album_Artist ‘D’".to_string(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
},
|
},
|
||||||
sort: None,
|
sort: None,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -447,7 +447,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title d.a".to_string(),
|
title: "album_title d.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(9),
|
lib_id: AlbumLibId::Value(9),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1995.into(),
|
date: 1995.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -489,7 +489,7 @@ macro_rules! full_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title d.b".to_string(),
|
title: "album_title d.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(10),
|
lib_id: AlbumLibId::Value(10),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2028.into(),
|
date: 2028.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
|
@ -6,7 +6,7 @@ macro_rules! library_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘A’".to_string(),
|
name: "Album_Artist ‘A’".to_string(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
},
|
},
|
||||||
sort: None,
|
sort: None,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -19,7 +19,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title a.a".to_string(),
|
title: "album_title a.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(1),
|
lib_id: AlbumLibId::Value(1),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1998.into(),
|
date: 1998.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -80,7 +80,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title a.b".to_string(),
|
title: "album_title a.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(2),
|
lib_id: AlbumLibId::Value(2),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: (2015, 4).into(),
|
date: (2015, 4).into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -117,7 +117,7 @@ macro_rules! library_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘B’".to_string(),
|
name: "Album_Artist ‘B’".to_string(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
},
|
},
|
||||||
sort: None,
|
sort: None,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -130,7 +130,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.a".to_string(),
|
title: "album_title b.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(3),
|
lib_id: AlbumLibId::Value(3),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: (2003, 6, 6).into(),
|
date: (2003, 6, 6).into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -169,7 +169,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.b".to_string(),
|
title: "album_title b.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(4),
|
lib_id: AlbumLibId::Value(4),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2008.into(),
|
date: 2008.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -208,7 +208,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.c".to_string(),
|
title: "album_title b.c".to_string(),
|
||||||
lib_id: AlbumLibId::Value(5),
|
lib_id: AlbumLibId::Value(5),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2009.into(),
|
date: 2009.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -247,7 +247,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title b.d".to_string(),
|
title: "album_title b.d".to_string(),
|
||||||
lib_id: AlbumLibId::Value(6),
|
lib_id: AlbumLibId::Value(6),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2015.into(),
|
date: 2015.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -287,7 +287,7 @@ macro_rules! library_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "The Album_Artist ‘C’".to_string(),
|
name: "The Album_Artist ‘C’".to_string(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
},
|
},
|
||||||
sort: Some("Album_Artist ‘C’, The".to_string()),
|
sort: Some("Album_Artist ‘C’, The".to_string()),
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -300,7 +300,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title c.a".to_string(),
|
title: "album_title c.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(7),
|
lib_id: AlbumLibId::Value(7),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1985.into(),
|
date: 1985.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -339,7 +339,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title c.b".to_string(),
|
title: "album_title c.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(8),
|
lib_id: AlbumLibId::Value(8),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2018.into(),
|
date: 2018.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -379,7 +379,7 @@ macro_rules! library_collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: "Album_Artist ‘D’".to_string(),
|
name: "Album_Artist ‘D’".to_string(),
|
||||||
db_id: ArtistDbId::None,
|
mb_ref: ArtistMbRef::None,
|
||||||
},
|
},
|
||||||
sort: None,
|
sort: None,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -392,7 +392,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title d.a".to_string(),
|
title: "album_title d.a".to_string(),
|
||||||
lib_id: AlbumLibId::Value(9),
|
lib_id: AlbumLibId::Value(9),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1995.into(),
|
date: 1995.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -431,7 +431,7 @@ macro_rules! library_collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: "album_title d.b".to_string(),
|
title: "album_title d.b".to_string(),
|
||||||
lib_id: AlbumLibId::Value(10),
|
lib_id: AlbumLibId::Value(10),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2028.into(),
|
date: 2028.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
|
@ -115,14 +115,14 @@ impl AppMachine<FetchState> {
|
|||||||
let mut requests = Self::search_artist_job(artist);
|
let mut requests = Self::search_artist_job(artist);
|
||||||
if requests.is_empty() {
|
if requests.is_empty() {
|
||||||
fetch = FetchState::fetch(rx);
|
fetch = FetchState::fetch(rx);
|
||||||
requests = Self::browse_release_group_job(&artist.meta.id.db_id);
|
requests = Self::browse_release_group_job(&artist.meta.id.mb_ref);
|
||||||
} else {
|
} else {
|
||||||
fetch = FetchState::search(rx);
|
fetch = FetchState::search(rx);
|
||||||
}
|
}
|
||||||
SubmitJob { fetch, requests }
|
SubmitJob { fetch, requests }
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let arid = match artist.meta.id.db_id {
|
let arid = match artist.meta.id.mb_ref {
|
||||||
MbRefOption::Some(ref mbref) => mbref,
|
MbRefOption::Some(ref mbref) => mbref,
|
||||||
_ => return Err("cannot fetch album: artist has no MBID"),
|
_ => return Err("cannot fetch album: artist has no MBID"),
|
||||||
};
|
};
|
||||||
@ -213,7 +213,7 @@ impl AppMachine<FetchState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn album_match(old: &AlbumMeta, new: &AlbumMeta) -> bool {
|
fn album_match(old: &AlbumMeta, new: &AlbumMeta) -> bool {
|
||||||
old.id.db_id.is_some() && (old.id.db_id == new.id.db_id)
|
old.id.mb_ref.is_some() && (old.id.mb_ref == new.id.mb_ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn app_lookup_artist(
|
pub fn app_lookup_artist(
|
||||||
@ -258,7 +258,7 @@ impl AppMachine<FetchState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn search_artist_job(artist: &Artist) -> VecDeque<MbParams> {
|
fn search_artist_job(artist: &Artist) -> VecDeque<MbParams> {
|
||||||
match artist.meta.id.db_id {
|
match artist.meta.id.mb_ref {
|
||||||
MbRefOption::Some(ref arid) => {
|
MbRefOption::Some(ref arid) => {
|
||||||
Self::search_albums_requests(&artist.meta.id, arid, &artist.albums)
|
Self::search_albums_requests(&artist.meta.id, arid, &artist.albums)
|
||||||
}
|
}
|
||||||
@ -287,7 +287,7 @@ impl AppMachine<FetchState> {
|
|||||||
let arid = arid.mbid();
|
let arid = arid.mbid();
|
||||||
albums
|
albums
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|album| album.meta.id.db_id.is_none())
|
.filter(|album| album.meta.id.mb_ref.is_none())
|
||||||
.map(|album| {
|
.map(|album| {
|
||||||
MbParams::search_release_group(artist.clone(), arid.clone(), album.meta.clone())
|
MbParams::search_release_group(artist.clone(), arid.clone(), album.meta.clone())
|
||||||
})
|
})
|
||||||
@ -784,7 +784,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn browse_release_group_expectation(artist: &Artist) -> MockIMbJobSender {
|
fn browse_release_group_expectation(artist: &Artist) -> MockIMbJobSender {
|
||||||
let requests = AppMachine::browse_release_group_job(&artist.meta.id.db_id);
|
let requests = AppMachine::browse_release_group_job(&artist.meta.id.mb_ref);
|
||||||
let mut mb_job_sender = MockIMbJobSender::new();
|
let mut mb_job_sender = MockIMbJobSender::new();
|
||||||
mb_job_sender
|
mb_job_sender
|
||||||
.expect_submit_background_job()
|
.expect_submit_background_job()
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use musichoard::collection::{
|
use musichoard::collection::{
|
||||||
album::{AlbumDbId, AlbumInfo, AlbumMeta},
|
album::{AlbumInfo, AlbumMbRef, AlbumMeta},
|
||||||
artist::{ArtistDbId, ArtistInfo, ArtistMeta},
|
artist::{ArtistInfo, ArtistMbRef, ArtistMeta},
|
||||||
musicbrainz::{MbRefOption, Mbid},
|
musicbrainz::{MbRefOption, Mbid},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -13,12 +13,12 @@ use crate::tui::app::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ArtistInfoTuple {
|
struct ArtistInfoTuple {
|
||||||
db_id: ArtistDbId,
|
mb_ref: ArtistMbRef,
|
||||||
info: ArtistInfo,
|
info: ArtistInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct AlbumInfoTuple {
|
struct AlbumInfoTuple {
|
||||||
db_id: AlbumDbId,
|
mb_ref: AlbumMbRef,
|
||||||
info: AlbumInfo,
|
info: AlbumInfo,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,17 +46,17 @@ impl GetInfo for MatchOption<ArtistMeta> {
|
|||||||
type InfoType = ArtistInfoTuple;
|
type InfoType = ArtistInfoTuple;
|
||||||
|
|
||||||
fn get_info(&self) -> InfoOption<Self::InfoType> {
|
fn get_info(&self) -> InfoOption<Self::InfoType> {
|
||||||
let db_id;
|
let mb_ref;
|
||||||
let mut info = ArtistInfo::default();
|
let mut info = ArtistInfo::default();
|
||||||
match self {
|
match self {
|
||||||
MatchOption::Some(option) => {
|
MatchOption::Some(option) => {
|
||||||
db_id = option.entity.id.db_id.clone();
|
mb_ref = option.entity.id.mb_ref.clone();
|
||||||
info = option.entity.info.clone();
|
info = option.entity.info.clone();
|
||||||
}
|
}
|
||||||
MatchOption::CannotHaveMbid => db_id = MbRefOption::CannotHaveMbid,
|
MatchOption::CannotHaveMbid => mb_ref = MbRefOption::CannotHaveMbid,
|
||||||
MatchOption::ManualInputMbid => return InfoOption::NeedInput,
|
MatchOption::ManualInputMbid => return InfoOption::NeedInput,
|
||||||
}
|
}
|
||||||
InfoOption::Info(ArtistInfoTuple { db_id, info })
|
InfoOption::Info(ArtistInfoTuple { mb_ref, info })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,17 +64,17 @@ impl GetInfo for MatchOption<AlbumMeta> {
|
|||||||
type InfoType = AlbumInfoTuple;
|
type InfoType = AlbumInfoTuple;
|
||||||
|
|
||||||
fn get_info(&self) -> InfoOption<Self::InfoType> {
|
fn get_info(&self) -> InfoOption<Self::InfoType> {
|
||||||
let db_id;
|
let mb_ref;
|
||||||
let mut info = AlbumInfo::default();
|
let mut info = AlbumInfo::default();
|
||||||
match self {
|
match self {
|
||||||
MatchOption::Some(option) => {
|
MatchOption::Some(option) => {
|
||||||
db_id = option.entity.id.db_id.clone();
|
mb_ref = option.entity.id.mb_ref.clone();
|
||||||
info = option.entity.info.clone();
|
info = option.entity.info.clone();
|
||||||
}
|
}
|
||||||
MatchOption::CannotHaveMbid => db_id = AlbumDbId::CannotHaveMbid,
|
MatchOption::CannotHaveMbid => mb_ref = AlbumMbRef::CannotHaveMbid,
|
||||||
MatchOption::ManualInputMbid => return InfoOption::NeedInput,
|
MatchOption::ManualInputMbid => return InfoOption::NeedInput,
|
||||||
}
|
}
|
||||||
InfoOption::Info(AlbumInfoTuple { db_id, info })
|
InfoOption::Info(AlbumInfoTuple { mb_ref, info })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,14 +248,14 @@ impl IAppInteractMatch for AppMachine<MatchState> {
|
|||||||
EntityMatches::Artist(ref mut matches) => match matches.list.extract_info(index) {
|
EntityMatches::Artist(ref mut matches) => match matches.list.extract_info(index) {
|
||||||
InfoOption::Info(tuple) => mh
|
InfoOption::Info(tuple) => mh
|
||||||
.merge_artist_info(&matches.matching.id, tuple.info)
|
.merge_artist_info(&matches.matching.id, tuple.info)
|
||||||
.and_then(|()| mh.set_artist_db_id(&matches.matching.id, tuple.db_id)),
|
.and_then(|()| mh.set_artist_mb_ref(&matches.matching.id, tuple.mb_ref)),
|
||||||
InfoOption::NeedInput => return self.get_input(),
|
InfoOption::NeedInput => return self.get_input(),
|
||||||
},
|
},
|
||||||
EntityMatches::Album(ref mut matches) => match matches.list.extract_info(index) {
|
EntityMatches::Album(ref mut matches) => match matches.list.extract_info(index) {
|
||||||
InfoOption::Info(tuple) => mh
|
InfoOption::Info(tuple) => mh
|
||||||
.merge_album_info(&matches.artist, &matches.matching, tuple.info)
|
.merge_album_info(&matches.artist, &matches.matching, tuple.info)
|
||||||
.and_then(|()| {
|
.and_then(|()| {
|
||||||
mh.set_album_db_id(&matches.artist, &matches.matching, tuple.db_id)
|
mh.set_album_mb_ref(&matches.artist, &matches.matching, tuple.mb_ref)
|
||||||
}),
|
}),
|
||||||
InfoOption::NeedInput => return self.get_input(),
|
InfoOption::NeedInput => return self.get_input(),
|
||||||
},
|
},
|
||||||
@ -314,7 +314,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn artist_meta() -> ArtistMeta {
|
fn artist_meta() -> ArtistMeta {
|
||||||
ArtistMeta::new(ArtistId::new("Artist").with_db_id(ArtistDbId::Some(mbid().into())))
|
ArtistMeta::new(ArtistId::new("Artist").with_mb_ref(ArtistMbRef::Some(mbid().into())))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn artist_match() -> EntityMatches {
|
fn artist_match() -> EntityMatches {
|
||||||
@ -327,20 +327,20 @@ mod tests {
|
|||||||
let mut artist_match_2 = Entity::with_score(artist_2, 100);
|
let mut artist_match_2 = Entity::with_score(artist_2, 100);
|
||||||
artist_match_2.disambiguation = Some(String::from("some disambiguation"));
|
artist_match_2.disambiguation = Some(String::from("some disambiguation"));
|
||||||
|
|
||||||
artist.clear_db_id();
|
artist.clear_mb_ref();
|
||||||
let list = vec![artist_match_1.clone(), artist_match_2.clone()];
|
let list = vec![artist_match_1.clone(), artist_match_2.clone()];
|
||||||
EntityMatches::artist_search(artist, list)
|
EntityMatches::artist_search(artist, list)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn artist_lookup() -> EntityMatches {
|
fn artist_lookup() -> EntityMatches {
|
||||||
let mut artist = artist_meta();
|
let mut artist = artist_meta();
|
||||||
artist.clear_db_id();
|
artist.clear_mb_ref();
|
||||||
let lookup = Entity::new(artist.clone());
|
let lookup = Entity::new(artist.clone());
|
||||||
EntityMatches::artist_lookup(artist, lookup)
|
EntityMatches::artist_lookup(artist, lookup)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn album_id() -> AlbumId {
|
fn album_id() -> AlbumId {
|
||||||
AlbumId::new("Album").with_db_id(MbRefOption::Some(mbid().into()))
|
AlbumId::new("Album").with_mb_ref(MbRefOption::Some(mbid().into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn album_meta(id: AlbumId) -> AlbumMeta {
|
fn album_meta(id: AlbumId) -> AlbumMeta {
|
||||||
@ -365,7 +365,7 @@ mod tests {
|
|||||||
album_2.info.secondary_types.pop();
|
album_2.info.secondary_types.pop();
|
||||||
let album_match_2 = Entity::with_score(album_2, 100);
|
let album_match_2 = Entity::with_score(album_2, 100);
|
||||||
|
|
||||||
album_id.clear_db_id();
|
album_id.clear_mb_ref();
|
||||||
let list = vec![album_match_1.clone(), album_match_2.clone()];
|
let list = vec![album_match_1.clone(), album_match_2.clone()];
|
||||||
EntityMatches::album_search(artist_id, album_id, list)
|
EntityMatches::album_search(artist_id, album_id, list)
|
||||||
}
|
}
|
||||||
@ -375,7 +375,7 @@ mod tests {
|
|||||||
let mut album_id = album_id();
|
let mut album_id = album_id();
|
||||||
let album_meta = album_meta(album_id.clone());
|
let album_meta = album_meta(album_id.clone());
|
||||||
|
|
||||||
album_id.clear_db_id();
|
album_id.clear_mb_ref();
|
||||||
let lookup = Entity::new(album_meta.clone());
|
let lookup = Entity::new(album_meta.clone());
|
||||||
EntityMatches::album_lookup(artist_id, album_id, lookup)
|
EntityMatches::album_lookup(artist_id, album_id, lookup)
|
||||||
}
|
}
|
||||||
@ -420,7 +420,7 @@ mod tests {
|
|||||||
match matches_info {
|
match matches_info {
|
||||||
EntityMatches::Album(_) => {
|
EntityMatches::Album(_) => {
|
||||||
let album_id = AlbumId::new("Album");
|
let album_id = AlbumId::new("Album");
|
||||||
let db_id = MbRefOption::CannotHaveMbid;
|
let mb_ref = MbRefOption::CannotHaveMbid;
|
||||||
let info = AlbumInfo::default();
|
let info = AlbumInfo::default();
|
||||||
|
|
||||||
let mut seq = Sequence::new();
|
let mut seq = Sequence::new();
|
||||||
@ -431,14 +431,14 @@ mod tests {
|
|||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _, _| Ok(()));
|
.return_once(|_, _, _| Ok(()));
|
||||||
music_hoard
|
music_hoard
|
||||||
.expect_set_album_db_id()
|
.expect_set_album_mb_ref()
|
||||||
.with(eq(artist_id.clone()), eq(album_id.clone()), eq(db_id))
|
.with(eq(artist_id.clone()), eq(album_id.clone()), eq(mb_ref))
|
||||||
.times(1)
|
.times(1)
|
||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _, _| Ok(()));
|
.return_once(|_, _, _| Ok(()));
|
||||||
}
|
}
|
||||||
EntityMatches::Artist(_) => {
|
EntityMatches::Artist(_) => {
|
||||||
let db_id = MbRefOption::CannotHaveMbid;
|
let mb_ref = MbRefOption::CannotHaveMbid;
|
||||||
let info = ArtistInfo::default();
|
let info = ArtistInfo::default();
|
||||||
|
|
||||||
let mut seq = Sequence::new();
|
let mut seq = Sequence::new();
|
||||||
@ -449,8 +449,8 @@ mod tests {
|
|||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _| Ok(()));
|
.return_once(|_, _| Ok(()));
|
||||||
music_hoard
|
music_hoard
|
||||||
.expect_set_artist_db_id()
|
.expect_set_artist_mb_ref()
|
||||||
.with(eq(artist_id.clone()), eq(db_id))
|
.with(eq(artist_id.clone()), eq(mb_ref))
|
||||||
.times(1)
|
.times(1)
|
||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _| Ok(()));
|
.return_once(|_, _| Ok(()));
|
||||||
@ -533,8 +533,8 @@ mod tests {
|
|||||||
EntityMatches::Album(_) => panic!(),
|
EntityMatches::Album(_) => panic!(),
|
||||||
EntityMatches::Artist(_) => {
|
EntityMatches::Artist(_) => {
|
||||||
let mut meta = artist_meta();
|
let mut meta = artist_meta();
|
||||||
let db_id = meta.id.db_id.clone();
|
let mb_ref = meta.id.mb_ref.clone();
|
||||||
meta.clear_db_id();
|
meta.clear_mb_ref();
|
||||||
|
|
||||||
let mut seq = Sequence::new();
|
let mut seq = Sequence::new();
|
||||||
music_hoard
|
music_hoard
|
||||||
@ -544,8 +544,8 @@ mod tests {
|
|||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _| Ok(()));
|
.return_once(|_, _| Ok(()));
|
||||||
music_hoard
|
music_hoard
|
||||||
.expect_set_artist_db_id()
|
.expect_set_artist_mb_ref()
|
||||||
.with(eq(meta.id.clone()), eq(db_id))
|
.with(eq(meta.id.clone()), eq(mb_ref))
|
||||||
.times(1)
|
.times(1)
|
||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _| Ok(()));
|
.return_once(|_, _| Ok(()));
|
||||||
@ -569,8 +569,8 @@ mod tests {
|
|||||||
EntityMatches::Album(matches) => {
|
EntityMatches::Album(matches) => {
|
||||||
let mut album_id = album_id();
|
let mut album_id = album_id();
|
||||||
let meta = album_meta(album_id.clone());
|
let meta = album_meta(album_id.clone());
|
||||||
let db_id = album_id.db_id.clone();
|
let mb_ref = album_id.mb_ref.clone();
|
||||||
album_id.clear_db_id();
|
album_id.clear_mb_ref();
|
||||||
let artist = matches.artist.clone();
|
let artist = matches.artist.clone();
|
||||||
|
|
||||||
let mut seq = Sequence::new();
|
let mut seq = Sequence::new();
|
||||||
@ -581,8 +581,8 @@ mod tests {
|
|||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _, _| Ok(()));
|
.return_once(|_, _, _| Ok(()));
|
||||||
music_hoard
|
music_hoard
|
||||||
.expect_set_album_db_id()
|
.expect_set_album_mb_ref()
|
||||||
.with(eq(artist.clone()), eq(album_id.clone()), eq(db_id))
|
.with(eq(artist.clone()), eq(album_id.clone()), eq(mb_ref))
|
||||||
.times(1)
|
.times(1)
|
||||||
.in_sequence(&mut seq)
|
.in_sequence(&mut seq)
|
||||||
.return_once(|_, _, _| Ok(()));
|
.return_once(|_, _, _| Ok(()));
|
||||||
|
@ -4,9 +4,9 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use musichoard::{
|
use musichoard::{
|
||||||
collection::{
|
collection::{
|
||||||
album::{AlbumDate, AlbumDbId, AlbumId, AlbumInfo, AlbumLibId, AlbumMeta, AlbumSeq},
|
album::{AlbumDate, AlbumId, AlbumInfo, AlbumLibId, AlbumMbRef, AlbumMeta, AlbumSeq},
|
||||||
artist::{ArtistId, ArtistInfo, ArtistMeta},
|
artist::{ArtistId, ArtistInfo, ArtistMbRef, ArtistMeta},
|
||||||
musicbrainz::{MbRefOption, Mbid},
|
musicbrainz::Mbid,
|
||||||
},
|
},
|
||||||
external::musicbrainz::{
|
external::musicbrainz::{
|
||||||
api::{
|
api::{
|
||||||
@ -117,7 +117,7 @@ fn from_mb_artist_meta(meta: MbArtistMeta) -> (ArtistMeta, Option<String>) {
|
|||||||
ArtistMeta {
|
ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: meta.name,
|
name: meta.name,
|
||||||
db_id: MbRefOption::Some(meta.id.into()),
|
mb_ref: ArtistMbRef::Some(meta.id.into()),
|
||||||
},
|
},
|
||||||
sort,
|
sort,
|
||||||
info: ArtistInfo {
|
info: ArtistInfo {
|
||||||
@ -133,7 +133,7 @@ fn from_mb_release_group_meta(meta: MbReleaseGroupMeta) -> AlbumMeta {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: meta.title,
|
title: meta.title,
|
||||||
lib_id: AlbumLibId::None,
|
lib_id: AlbumLibId::None,
|
||||||
db_id: AlbumDbId::Some(meta.id.into()),
|
mb_ref: AlbumMbRef::Some(meta.id.into()),
|
||||||
},
|
},
|
||||||
date: meta.first_release_date,
|
date: meta.first_release_date,
|
||||||
seq: AlbumSeq::default(),
|
seq: AlbumSeq::default(),
|
||||||
|
@ -454,7 +454,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn search_albums_requests() -> VecDeque<MbParams> {
|
fn search_albums_requests() -> VecDeque<MbParams> {
|
||||||
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.db_id);
|
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.mb_ref);
|
||||||
let arid = mb_ref_opt_unwrap(mbref).mbid().clone();
|
let arid = mb_ref_opt_unwrap(mbref).mbid().clone();
|
||||||
|
|
||||||
let artist_id = COLLECTION[1].meta.id.clone();
|
let artist_id = COLLECTION[1].meta.id.clone();
|
||||||
@ -468,7 +468,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn browse_albums_requests() -> VecDeque<MbParams> {
|
fn browse_albums_requests() -> VecDeque<MbParams> {
|
||||||
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.db_id);
|
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.mb_ref);
|
||||||
let arid = mb_ref_opt_unwrap(mbref).mbid().clone();
|
let arid = mb_ref_opt_unwrap(mbref).mbid().clone();
|
||||||
VecDeque::from([MbParams::browse_release_group(arid)])
|
VecDeque::from([MbParams::browse_release_group(arid)])
|
||||||
}
|
}
|
||||||
@ -478,7 +478,7 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn album_arid_expectation() -> Mbid {
|
fn album_arid_expectation() -> Mbid {
|
||||||
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.db_id);
|
let mbref = mb_ref_opt_as_ref(&COLLECTION[1].meta.id.mb_ref);
|
||||||
mb_ref_opt_unwrap(mbref).mbid().clone()
|
mb_ref_opt_unwrap(mbref).mbid().clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@ pub mod interface;
|
|||||||
|
|
||||||
use musichoard::{
|
use musichoard::{
|
||||||
collection::{
|
collection::{
|
||||||
album::{AlbumDbId, AlbumId, AlbumInfo, AlbumMeta},
|
album::{AlbumId, AlbumInfo, AlbumMbRef, AlbumMeta},
|
||||||
artist::{ArtistDbId, ArtistId, ArtistInfo},
|
artist::{ArtistId, ArtistInfo, ArtistMbRef},
|
||||||
Collection,
|
Collection,
|
||||||
},
|
},
|
||||||
interface::{database::IDatabase, library::ILibrary},
|
interface::{database::IDatabase, library::ILibrary},
|
||||||
@ -26,21 +26,21 @@ pub trait IMusicHoard {
|
|||||||
album_meta: AlbumMeta,
|
album_meta: AlbumMeta,
|
||||||
) -> Result<(), musichoard::Error>;
|
) -> Result<(), musichoard::Error>;
|
||||||
|
|
||||||
fn set_artist_db_id(
|
fn set_artist_mb_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: &ArtistId,
|
artist_id: &ArtistId,
|
||||||
db_id: ArtistDbId,
|
mb_ref: ArtistMbRef,
|
||||||
) -> Result<(), musichoard::Error>;
|
) -> Result<(), musichoard::Error>;
|
||||||
fn merge_artist_info(
|
fn merge_artist_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
id: &ArtistId,
|
id: &ArtistId,
|
||||||
info: ArtistInfo,
|
info: ArtistInfo,
|
||||||
) -> Result<(), musichoard::Error>;
|
) -> Result<(), musichoard::Error>;
|
||||||
fn set_album_db_id(
|
fn set_album_mb_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: &ArtistId,
|
artist_id: &ArtistId,
|
||||||
album_id: &AlbumId,
|
album_id: &AlbumId,
|
||||||
db_id: AlbumDbId,
|
mb_ref: AlbumMbRef,
|
||||||
) -> Result<(), musichoard::Error>;
|
) -> Result<(), musichoard::Error>;
|
||||||
fn merge_album_info(
|
fn merge_album_info(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -72,12 +72,12 @@ impl<Database: IDatabase, Library: ILibrary> IMusicHoard for MusicHoard<Database
|
|||||||
<Self as IMusicHoardDatabase>::add_album(self, artist_id, album_meta)
|
<Self as IMusicHoardDatabase>::add_album(self, artist_id, album_meta)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_artist_db_id(
|
fn set_artist_mb_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: &ArtistId,
|
artist_id: &ArtistId,
|
||||||
db_id: ArtistDbId,
|
mb_ref: ArtistMbRef,
|
||||||
) -> Result<(), musichoard::Error> {
|
) -> Result<(), musichoard::Error> {
|
||||||
<Self as IMusicHoardDatabase>::set_artist_db_id(self, artist_id, db_id)
|
<Self as IMusicHoardDatabase>::set_artist_mb_ref(self, artist_id, mb_ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn merge_artist_info(
|
fn merge_artist_info(
|
||||||
@ -88,13 +88,13 @@ impl<Database: IDatabase, Library: ILibrary> IMusicHoard for MusicHoard<Database
|
|||||||
<Self as IMusicHoardDatabase>::merge_artist_info(self, id, info)
|
<Self as IMusicHoardDatabase>::merge_artist_info(self, id, info)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_album_db_id(
|
fn set_album_mb_ref(
|
||||||
&mut self,
|
&mut self,
|
||||||
artist_id: &ArtistId,
|
artist_id: &ArtistId,
|
||||||
album_id: &AlbumId,
|
album_id: &AlbumId,
|
||||||
db_id: AlbumDbId,
|
mb_ref: AlbumMbRef,
|
||||||
) -> Result<(), musichoard::Error> {
|
) -> Result<(), musichoard::Error> {
|
||||||
<Self as IMusicHoardDatabase>::set_album_db_id(self, artist_id, album_id, db_id)
|
<Self as IMusicHoardDatabase>::set_album_mb_ref(self, artist_id, album_id, mb_ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn merge_album_info(
|
fn merge_album_info(
|
||||||
|
@ -2,9 +2,9 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use musichoard::collection::{
|
use musichoard::collection::{
|
||||||
album::{
|
album::{
|
||||||
Album, AlbumDbId, AlbumId, AlbumInfo, AlbumLibId, AlbumMeta, AlbumPrimaryType, AlbumSeq,
|
Album, AlbumId, AlbumInfo, AlbumLibId, AlbumMbRef, AlbumMeta, AlbumPrimaryType, AlbumSeq,
|
||||||
},
|
},
|
||||||
artist::{Artist, ArtistDbId, ArtistId, ArtistInfo, ArtistMeta},
|
artist::{Artist, ArtistId, ArtistInfo, ArtistMbRef, ArtistMeta},
|
||||||
musicbrainz::{MbAlbumRef, MbArtistRef},
|
musicbrainz::{MbAlbumRef, MbArtistRef},
|
||||||
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
||||||
};
|
};
|
||||||
|
@ -76,7 +76,7 @@ impl<'a> ArtistOverlay<'a> {
|
|||||||
Properties: {}",
|
Properties: {}",
|
||||||
artist.map(|a| a.meta.id.name.as_str()).unwrap_or(""),
|
artist.map(|a| a.meta.id.name.as_str()).unwrap_or(""),
|
||||||
artist
|
artist
|
||||||
.map(|a| UiDisplay::display_mb_ref_option_as_url(&a.meta.id.db_id))
|
.map(|a| UiDisplay::display_mb_ref_option_as_url(&a.meta.id.mb_ref))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
Self::opt_hashmap_to_string(
|
Self::opt_hashmap_to_string(
|
||||||
artist.map(|a| &a.meta.info.properties),
|
artist.map(|a| &a.meta.info.properties),
|
||||||
@ -108,7 +108,7 @@ impl<'a> AlbumOverlay<'a> {
|
|||||||
.map(|a| UiDisplay::display_album_lib_id(&a.meta.id.lib_id))
|
.map(|a| UiDisplay::display_album_lib_id(&a.meta.id.lib_id))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
album
|
album
|
||||||
.map(|a| UiDisplay::display_mb_ref_option_as_url(&a.meta.id.db_id))
|
.map(|a| UiDisplay::display_mb_ref_option_as_url(&a.meta.id.mb_ref))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use musichoard::collection::{
|
use musichoard::collection::{
|
||||||
album::{
|
album::{
|
||||||
Album, AlbumDbId, AlbumId, AlbumInfo, AlbumLibId, AlbumMeta, AlbumPrimaryType,
|
Album, AlbumId, AlbumInfo, AlbumLibId, AlbumMbRef, AlbumMeta, AlbumPrimaryType,
|
||||||
AlbumSecondaryType, AlbumSeq,
|
AlbumSecondaryType, AlbumSeq,
|
||||||
},
|
},
|
||||||
artist::{Artist, ArtistDbId, ArtistId, ArtistInfo, ArtistMeta},
|
artist::{Artist, ArtistId, ArtistInfo, ArtistMbRef, ArtistMeta},
|
||||||
musicbrainz::MbArtistRef,
|
musicbrainz::MbArtistRef,
|
||||||
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
|
||||||
Collection,
|
Collection,
|
||||||
@ -18,7 +18,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: String::from("Аркона"),
|
name: String::from("Аркона"),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/baad262d-55ef-427a-83c7-f7530964f212"
|
"https://musicbrainz.org/artist/baad262d-55ef-427a-83c7-f7530964f212"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -42,7 +42,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Slovo"),
|
title: String::from("Slovo"),
|
||||||
lib_id: AlbumLibId::Value(7),
|
lib_id: AlbumLibId::Value(7),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2011.into(),
|
date: 2011.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -213,7 +213,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: String::from("Eluveitie"),
|
name: String::from("Eluveitie"),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/8000598a-5edb-401c-8e6d-36b167feaf38"
|
"https://musicbrainz.org/artist/8000598a-5edb-401c-8e6d-36b167feaf38"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -235,7 +235,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Vên [re‐recorded]"),
|
title: String::from("Vên [re‐recorded]"),
|
||||||
lib_id: AlbumLibId::Value(1),
|
lib_id: AlbumLibId::Value(1),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2004.into(),
|
date: 2004.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -318,7 +318,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Slania"),
|
title: String::from("Slania"),
|
||||||
lib_id: AlbumLibId::Value(2),
|
lib_id: AlbumLibId::Value(2),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2008.into(),
|
date: 2008.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -468,7 +468,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: String::from("Frontside"),
|
name: String::from("Frontside"),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/3a901353-fccd-4afd-ad01-9c03f451b490"
|
"https://musicbrainz.org/artist/3a901353-fccd-4afd-ad01-9c03f451b490"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -489,7 +489,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"),
|
title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"),
|
||||||
lib_id: AlbumLibId::Value(3),
|
lib_id: AlbumLibId::Value(3),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2001.into(),
|
date: 2001.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -627,7 +627,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: String::from("Heaven’s Basement"),
|
name: String::from("Heaven’s Basement"),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/c2c4d56a-d599-4a18-bd2f-ae644e2198cc"
|
"https://musicbrainz.org/artist/c2c4d56a-d599-4a18-bd2f-ae644e2198cc"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -648,7 +648,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Paper Plague"),
|
title: String::from("Paper Plague"),
|
||||||
lib_id: AlbumLibId::Singleton,
|
lib_id: AlbumLibId::Singleton,
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2011.into(),
|
date: 2011.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -672,7 +672,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Unbreakable"),
|
title: String::from("Unbreakable"),
|
||||||
lib_id: AlbumLibId::Value(4),
|
lib_id: AlbumLibId::Value(4),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 2011.into(),
|
date: 2011.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -766,7 +766,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
meta: ArtistMeta {
|
meta: ArtistMeta {
|
||||||
id: ArtistId {
|
id: ArtistId {
|
||||||
name: String::from("Metallica"),
|
name: String::from("Metallica"),
|
||||||
db_id: ArtistDbId::Some(MbArtistRef::from_url_str(
|
mb_ref: ArtistMbRef::Some(MbArtistRef::from_url_str(
|
||||||
"https://musicbrainz.org/artist/65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab"
|
"https://musicbrainz.org/artist/65f4f0c5-ef9e-490c-aee3-909e7ae6b2ab"
|
||||||
).unwrap()),
|
).unwrap()),
|
||||||
},
|
},
|
||||||
@ -788,7 +788,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("Ride the Lightning"),
|
title: String::from("Ride the Lightning"),
|
||||||
lib_id: AlbumLibId::Value(5),
|
lib_id: AlbumLibId::Value(5),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1984.into(),
|
date: 1984.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
@ -893,7 +893,7 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
|
|||||||
id: AlbumId {
|
id: AlbumId {
|
||||||
title: String::from("S&M"),
|
title: String::from("S&M"),
|
||||||
lib_id: AlbumLibId::Value(6),
|
lib_id: AlbumLibId::Value(6),
|
||||||
db_id: AlbumDbId::None,
|
mb_ref: AlbumMbRef::None,
|
||||||
},
|
},
|
||||||
date: 1999.into(),
|
date: 1999.into(),
|
||||||
seq: AlbumSeq(0),
|
seq: AlbumSeq(0),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user