2024-01-21 15:29:37 +01:00
|
|
|
|
macro_rules! library_collection {
|
|
|
|
|
() => {
|
|
|
|
|
vec![
|
|
|
|
|
Artist {
|
|
|
|
|
id: ArtistId {
|
2024-02-18 22:12:41 +01:00
|
|
|
|
name: "Album_Artist ‘A’".to_string(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
},
|
|
|
|
|
sort: None,
|
2024-02-09 18:41:20 +01:00
|
|
|
|
musicbrainz: None,
|
|
|
|
|
properties: HashMap::new(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
albums: vec![
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 1998,
|
|
|
|
|
title: "album_title a.a".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track a.a.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist a.a.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 992,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track a.a.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist a.a.2.1".to_string(),
|
|
|
|
|
"artist a.a.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 320,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 3,
|
|
|
|
|
title: "track a.a.3".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist a.a.3".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1061,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-02-05 23:44:30 +01:00
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 4,
|
|
|
|
|
title: "track a.a.4".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist a.a.4".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1042,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-01-21 15:29:37 +01:00
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2015,
|
|
|
|
|
title: "album_title a.b".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track a.b.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist a.b.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1004,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track a.b.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist a.b.2".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1077,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Artist {
|
|
|
|
|
id: ArtistId {
|
2024-02-18 22:12:41 +01:00
|
|
|
|
name: "Album_Artist ‘B’".to_string(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
},
|
|
|
|
|
sort: None,
|
2024-02-09 18:41:20 +01:00
|
|
|
|
musicbrainz: None,
|
|
|
|
|
properties: HashMap::new(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
albums: vec![
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2003,
|
|
|
|
|
title: "album_title b.a".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track b.a.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist b.a.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 190,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track b.a.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist b.a.2.1".to_string(),
|
|
|
|
|
"artist b.a.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2008,
|
|
|
|
|
title: "album_title b.b".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track b.b.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist b.b.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1077,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track b.b.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist b.b.2.1".to_string(),
|
|
|
|
|
"artist b.b.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 320,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-02-05 23:44:30 +01:00
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2009,
|
|
|
|
|
title: "album_title b.c".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track b.c.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist b.c.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 190,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track b.c.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist b.c.2.1".to_string(),
|
|
|
|
|
"artist b.c.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2015,
|
|
|
|
|
title: "album_title b.d".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track b.d.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist b.d.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 190,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track b.d.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist b.d.2.1".to_string(),
|
|
|
|
|
"artist b.d.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-01-21 15:29:37 +01:00
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Artist {
|
|
|
|
|
id: ArtistId {
|
2024-02-18 22:12:41 +01:00
|
|
|
|
name: "The Album_Artist ‘C’".to_string(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
},
|
2024-02-18 22:12:41 +01:00
|
|
|
|
sort: Some(ArtistId {
|
|
|
|
|
name: "Album_Artist ‘C’, The".to_string(),
|
|
|
|
|
}),
|
2024-02-09 18:41:20 +01:00
|
|
|
|
musicbrainz: None,
|
|
|
|
|
properties: HashMap::new(),
|
2024-01-21 15:29:37 +01:00
|
|
|
|
albums: vec![
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 1985,
|
|
|
|
|
title: "album_title c.a".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track c.a.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist c.a.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 320,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track c.a.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist c.a.2.1".to_string(),
|
|
|
|
|
"artist c.a.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2018,
|
|
|
|
|
title: "album_title c.b".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track c.b.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist c.b.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 1041,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track c.b.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist c.b.2.1".to_string(),
|
|
|
|
|
"artist c.b.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 756,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-02-05 23:44:30 +01:00
|
|
|
|
Artist {
|
|
|
|
|
id: ArtistId {
|
2024-02-18 22:12:41 +01:00
|
|
|
|
name: "Album_Artist ‘D’".to_string(),
|
2024-02-05 23:44:30 +01:00
|
|
|
|
},
|
|
|
|
|
sort: None,
|
2024-02-09 18:41:20 +01:00
|
|
|
|
musicbrainz: None,
|
|
|
|
|
properties: HashMap::new(),
|
2024-02-05 23:44:30 +01:00
|
|
|
|
albums: vec![
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 1995,
|
|
|
|
|
title: "album_title d.a".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track d.a.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist d.a.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track d.a.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist d.a.2.1".to_string(),
|
|
|
|
|
"artist d.a.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Mp3,
|
|
|
|
|
bitrate: 120,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
Album {
|
|
|
|
|
id: AlbumId {
|
|
|
|
|
year: 2028,
|
|
|
|
|
title: "album_title d.b".to_string(),
|
|
|
|
|
},
|
|
|
|
|
tracks: vec![
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 1,
|
|
|
|
|
title: "track d.b.1".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec!["artist d.b.1".to_string()],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 841,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Track {
|
|
|
|
|
id: TrackId {
|
|
|
|
|
number: 2,
|
|
|
|
|
title: "track d.b.2".to_string(),
|
|
|
|
|
},
|
|
|
|
|
artist: vec![
|
|
|
|
|
"artist d.b.2.1".to_string(),
|
|
|
|
|
"artist d.b.2.2".to_string(),
|
|
|
|
|
],
|
|
|
|
|
quality: Quality {
|
|
|
|
|
format: Format::Flac,
|
|
|
|
|
bitrate: 756,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
2024-01-21 15:29:37 +01:00
|
|
|
|
]
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
macro_rules! full_collection {
|
|
|
|
|
() => {{
|
|
|
|
|
let mut collection = library_collection!();
|
|
|
|
|
let mut iter = collection.iter_mut();
|
|
|
|
|
|
|
|
|
|
let artist_a = iter.next().unwrap();
|
2024-02-18 22:12:41 +01:00
|
|
|
|
assert_eq!(artist_a.id.name, "Album_Artist ‘A’");
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
2024-02-09 18:41:20 +01:00
|
|
|
|
artist_a.musicbrainz = Some(
|
|
|
|
|
MusicBrainz::new(
|
|
|
|
|
"https://musicbrainz.org/artist/00000000-0000-0000-0000-000000000000",
|
|
|
|
|
)
|
2024-01-21 15:29:37 +01:00
|
|
|
|
.unwrap(),
|
2024-02-09 18:41:20 +01:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
artist_a.properties = HashMap::from([
|
|
|
|
|
(String::from("MusicButler"), vec![
|
|
|
|
|
String::from("https://www.musicbutler.io/artist-page/000000000"),
|
|
|
|
|
]),
|
|
|
|
|
(String::from("Qobuz"), vec![
|
|
|
|
|
String::from(
|
2024-01-21 15:29:37 +01:00
|
|
|
|
"https://www.qobuz.com/nl-nl/interpreter/artist-a/download-streaming-albums",
|
|
|
|
|
)
|
2024-02-09 18:41:20 +01:00
|
|
|
|
]),
|
|
|
|
|
]);
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
|
|
|
|
let artist_b = iter.next().unwrap();
|
2024-02-18 22:12:41 +01:00
|
|
|
|
assert_eq!(artist_b.id.name, "Album_Artist ‘B’");
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
2024-02-09 18:41:20 +01:00
|
|
|
|
artist_b.musicbrainz = Some(
|
|
|
|
|
MusicBrainz::new(
|
|
|
|
|
"https://musicbrainz.org/artist/11111111-1111-1111-1111-111111111111",
|
|
|
|
|
).unwrap(),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
artist_b.properties = HashMap::from([
|
|
|
|
|
(String::from("MusicButler"), vec![
|
|
|
|
|
String::from("https://www.musicbutler.io/artist-page/111111111"),
|
|
|
|
|
String::from("https://www.musicbutler.io/artist-page/111111112"),
|
|
|
|
|
]),
|
|
|
|
|
(String::from("Bandcamp"), vec![String::from("https://artist-b.bandcamp.com/")]),
|
|
|
|
|
(String::from("Qobuz"), vec![
|
|
|
|
|
String::from(
|
2024-01-21 15:29:37 +01:00
|
|
|
|
"https://www.qobuz.com/nl-nl/interpreter/artist-b/download-streaming-albums",
|
|
|
|
|
)
|
2024-02-09 18:41:20 +01:00
|
|
|
|
]),
|
|
|
|
|
]);
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
|
|
|
|
let artist_c = iter.next().unwrap();
|
2024-02-18 22:12:41 +01:00
|
|
|
|
assert_eq!(artist_c.id.name, "The Album_Artist ‘C’");
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
2024-02-09 18:41:20 +01:00
|
|
|
|
artist_c.musicbrainz = Some(
|
|
|
|
|
MusicBrainz::new(
|
|
|
|
|
"https://musicbrainz.org/artist/11111111-1111-1111-1111-111111111111",
|
|
|
|
|
).unwrap(),
|
|
|
|
|
);
|
2024-01-21 15:29:37 +01:00
|
|
|
|
|
2024-02-05 23:44:30 +01:00
|
|
|
|
// Nothing for artist_d
|
|
|
|
|
|
2024-01-21 15:29:37 +01:00
|
|
|
|
collection
|
|
|
|
|
}};
|
|
|
|
|
}
|
2024-01-22 23:01:34 +01:00
|
|
|
|
|
|
|
|
|
pub(crate) use full_collection;
|
|
|
|
|
pub(crate) use library_collection;
|