Id should be id only
All checks were successful
Cargo CI / Build and Test (pull_request) Successful in 1m45s
Cargo CI / Lint (pull_request) Successful in 1m13s

This commit is contained in:
Wojciech Kozlowski 2024-03-02 12:25:08 +01:00
parent 3b57cce671
commit b043b6b207
10 changed files with 307 additions and 239 deletions

View File

@ -9,17 +9,19 @@ use crate::core::collection::{
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Album { pub struct Album {
pub id: AlbumId, pub id: AlbumId,
pub date: AlbumDate,
pub seq: AlbumSeq,
pub tracks: Vec<Track>, pub tracks: Vec<Track>,
} }
/// The album identifier. /// The album identifier.
#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] #[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub struct AlbumId { pub struct AlbumId {
pub date: AlbumDate,
pub title: String, pub title: String,
} }
// There are crates for handling dates, but we don't need much complexity beyond year-month-day. // There are crates for handling dates, but we don't need much complexity beyond year-month-day.
/// The album's release date.
#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] #[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub struct AlbumDate { pub struct AlbumDate {
pub year: u32, pub year: u32,
@ -27,6 +29,10 @@ pub struct AlbumDate {
pub day: u8, pub day: u8,
} }
/// The album's sequence to determine order when two or more albums have the same release date.
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub struct AlbumSeq(pub u8);
#[repr(u8)] #[repr(u8)]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] #[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)]
pub enum AlbumMonth { pub enum AlbumMonth {
@ -66,8 +72,8 @@ impl From<u8> for AlbumMonth {
} }
impl Album { impl Album {
pub fn get_sort_key(&self) -> &AlbumId { pub fn get_sort_key(&self) -> (&AlbumDate, &AlbumSeq, &AlbumId) {
&self.id (&self.date, &self.seq, &self.id)
} }
} }
@ -79,7 +85,7 @@ impl PartialOrd for Album {
impl Ord for Album { impl Ord for Album {
fn cmp(&self, other: &Self) -> std::cmp::Ordering { fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.id.cmp(&other.id) self.get_sort_key().cmp(&other.get_sort_key())
} }
} }
@ -116,6 +122,38 @@ mod tests {
assert_eq!(<u8 as Into<AlbumMonth>>::into(255), AlbumMonth::None); assert_eq!(<u8 as Into<AlbumMonth>>::into(255), AlbumMonth::None);
} }
#[test]
fn same_date_seq_cmp() {
let date = AlbumDate {
year: 2024,
month: AlbumMonth::March,
day: 2,
};
let album_id_1 = AlbumId {
title: String::from("album z"),
};
let album_1 = Album {
id: album_id_1,
date: date.clone(),
seq: AlbumSeq(1),
tracks: vec![],
};
let album_id_2 = AlbumId {
title: String::from("album a"),
};
let album_2 = Album {
id: album_id_2,
date: date.clone(),
seq: AlbumSeq(2),
tracks: vec![],
};
assert_ne!(album_1, album_2);
assert!(album_1 < album_2);
}
#[test] #[test]
fn merge_album_no_overlap() { fn merge_album_no_overlap() {
let left = FULL_COLLECTION[0].albums[0].to_owned(); let left = FULL_COLLECTION[0].albums[0].to_owned();
@ -129,9 +167,9 @@ mod tests {
let merged = left.clone().merge(right.clone()); let merged = left.clone().merge(right.clone());
assert_eq!(expected, merged); assert_eq!(expected, merged);
// Non-overlapping merge should be commutative. // Non-overlapping merge should be commutative in the tracks.
let merged = right.clone().merge(left.clone()); let merged = right.clone().merge(left.clone());
assert_eq!(expected, merged); assert_eq!(expected.tracks, merged.tracks);
} }
#[test] #[test]

View File

@ -4,6 +4,7 @@ use crate::core::collection::merge::Merge;
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
pub struct Track { pub struct Track {
pub id: TrackId, pub id: TrackId,
pub number: TrackNum,
pub artist: Vec<String>, pub artist: Vec<String>,
pub quality: TrackQuality, pub quality: TrackQuality,
} }
@ -11,10 +12,13 @@ pub struct Track {
/// The track identifier. /// The track identifier.
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TrackId { pub struct TrackId {
pub number: u32,
pub title: String, pub title: String,
} }
/// The track number.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TrackNum(pub u32);
/// The track quality. Combines format and bitrate information. /// The track quality. Combines format and bitrate information.
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct TrackQuality { pub struct TrackQuality {
@ -23,8 +27,8 @@ pub struct TrackQuality {
} }
impl Track { impl Track {
pub fn get_sort_key(&self) -> &TrackId { pub fn get_sort_key(&self) -> (&TrackNum, &TrackId) {
&self.id (&self.number, &self.id)
} }
} }
@ -43,7 +47,7 @@ impl PartialOrd for Track {
impl Ord for Track { impl Ord for Track {
fn cmp(&self, other: &Self) -> std::cmp::Ordering { fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.id.cmp(&other.id) self.get_sort_key().cmp(&other.get_sort_key())
} }
} }
@ -61,9 +65,9 @@ mod tests {
fn merge_track() { fn merge_track() {
let left = Track { let left = Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("a title"), title: String::from("a title"),
}, },
number: TrackNum(4),
artist: vec![String::from("left artist")], artist: vec![String::from("left artist")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -72,6 +76,7 @@ mod tests {
}; };
let right = Track { let right = Track {
id: left.id.clone(), id: left.id.clone(),
number: left.number,
artist: vec![String::from("right artist")], artist: vec![String::from("right artist")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,

View File

@ -2,9 +2,9 @@ use std::collections::HashMap;
use crate::core::{ use crate::core::{
collection::{ collection::{
album::{Album, AlbumDate, AlbumId}, album::{Album, AlbumDate, AlbumId, AlbumSeq},
artist::{Artist, ArtistId}, artist::{Artist, ArtistId},
track::{Track, TrackId, TrackQuality}, track::{Track, TrackId, TrackNum, TrackQuality},
Collection, Merge, Collection, Merge,
}, },
database::IDatabase, database::IDatabase,
@ -99,19 +99,20 @@ impl<LIB, DB> MusicHoard<LIB, DB> {
let artist_sort = item.album_artist_sort.map(|s| ArtistId { name: s }); let artist_sort = item.album_artist_sort.map(|s| ArtistId { name: s });
let album_id = AlbumId { let album_id = AlbumId {
date: AlbumDate { title: item.album_title,
};
let album_date = AlbumDate {
year: item.album_year, year: item.album_year,
month: item.album_month, month: item.album_month,
day: item.album_day, day: item.album_day,
},
title: item.album_title,
}; };
let track = Track { let track = Track {
id: TrackId { id: TrackId {
number: item.track_number,
title: item.track_title, title: item.track_title,
}, },
number: TrackNum(item.track_number),
artist: item.track_artist, artist: item.track_artist,
quality: TrackQuality { quality: TrackQuality {
format: item.track_format, format: item.track_format,
@ -153,6 +154,8 @@ impl<LIB, DB> MusicHoard<LIB, DB> {
Some(album) => album.tracks.push(track), Some(album) => album.tracks.push(track),
None => artist.albums.push(Album { None => artist.albums.push(Album {
id: album_id, id: album_id,
date: album_date,
seq: AlbumSeq(0),
tracks: vec![track], tracks: vec![track],
}), }),
} }
@ -891,7 +894,7 @@ mod tests {
} }
#[test] #[test]
fn rescan_library_album_title_date_clash() { fn rescan_library_album_id_clash() {
let mut library = MockILibrary::new(); let mut library = MockILibrary::new();
let mut expected = LIBRARY_COLLECTION.to_owned(); let mut expected = LIBRARY_COLLECTION.to_owned();
@ -899,15 +902,10 @@ mod tests {
let clashed_album_id = &expected[1].albums[0].id; let clashed_album_id = &expected[1].albums[0].id;
let mut items = LIBRARY_ITEMS.to_owned(); let mut items = LIBRARY_ITEMS.to_owned();
for item in items.iter_mut().filter(|it| { for item in items
(it.album_year == removed_album_id.date.year) .iter_mut()
&& (it.album_month == removed_album_id.date.month) .filter(|it| it.album_title == removed_album_id.title)
&& (it.album_day == removed_album_id.date.day) {
&& (it.album_title == removed_album_id.title)
}) {
item.album_year = clashed_album_id.date.year;
item.album_month = clashed_album_id.date.month;
item.album_day = clashed_album_id.date.day;
item.album_title = clashed_album_id.title.clone(); item.album_title = clashed_album_id.title.clone();
} }
@ -925,6 +923,7 @@ mod tests {
let mut music_hoard = MusicHoard::library(library); let mut music_hoard = MusicHoard::library(library);
music_hoard.rescan_library().unwrap(); music_hoard.rescan_library().unwrap();
assert_eq!(music_hoard.get_collection()[0], expected[0]);
assert_eq!(music_hoard.get_collection(), &expected); assert_eq!(music_hoard.get_collection(), &expected);
} }

View File

@ -2,9 +2,9 @@ use once_cell::sync::Lazy;
use std::collections::HashMap; use std::collections::HashMap;
use crate::core::collection::{ use crate::core::collection::{
album::{Album, AlbumDate, AlbumId, AlbumMonth}, album::{Album, AlbumDate, AlbumId, AlbumMonth, AlbumSeq},
artist::{Artist, ArtistId, MusicBrainz}, artist::{Artist, ArtistId, MusicBrainz},
track::{Track, TrackFormat, TrackId, TrackQuality}, track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
}; };
use crate::tests::*; use crate::tests::*;

View File

@ -11,19 +11,20 @@ macro_rules! library_collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title a.a".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 1998, year: 1998,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title a.a".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track a.a.1".to_string(), title: "track a.a.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist a.a.1".to_string()], artist: vec!["artist a.a.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -32,9 +33,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track a.a.2".to_string(), title: "track a.a.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist a.a.2.1".to_string(), "artist a.a.2.1".to_string(),
"artist a.a.2.2".to_string(), "artist a.a.2.2".to_string(),
@ -46,9 +47,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: "track a.a.3".to_string(), title: "track a.a.3".to_string(),
}, },
number: TrackNum(3),
artist: vec!["artist a.a.3".to_string()], artist: vec!["artist a.a.3".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -57,9 +58,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: "track a.a.4".to_string(), title: "track a.a.4".to_string(),
}, },
number: TrackNum(4),
artist: vec!["artist a.a.4".to_string()], artist: vec!["artist a.a.4".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -70,19 +71,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title a.b".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2015, year: 2015,
month: AlbumMonth::April, month: AlbumMonth::April,
day: 0, day: 0,
}, },
title: "album_title a.b".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track a.b.1".to_string(), title: "track a.b.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist a.b.1".to_string()], artist: vec!["artist a.b.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -91,9 +93,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track a.b.2".to_string(), title: "track a.b.2".to_string(),
}, },
number: TrackNum(2),
artist: vec!["artist a.b.2".to_string()], artist: vec!["artist a.b.2".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -114,19 +116,20 @@ macro_rules! library_collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title b.a".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2003, year: 2003,
month: AlbumMonth::June, month: AlbumMonth::June,
day: 6, day: 6,
}, },
title: "album_title b.a".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track b.a.1".to_string(), title: "track b.a.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist b.a.1".to_string()], artist: vec!["artist b.a.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -135,9 +138,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track b.a.2".to_string(), title: "track b.a.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist b.a.2.1".to_string(), "artist b.a.2.1".to_string(),
"artist b.a.2.2".to_string(), "artist b.a.2.2".to_string(),
@ -151,19 +154,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title b.b".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2008, year: 2008,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title b.b".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track b.b.1".to_string(), title: "track b.b.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist b.b.1".to_string()], artist: vec!["artist b.b.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -172,9 +176,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track b.b.2".to_string(), title: "track b.b.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist b.b.2.1".to_string(), "artist b.b.2.1".to_string(),
"artist b.b.2.2".to_string(), "artist b.b.2.2".to_string(),
@ -188,19 +192,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title b.c".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2009, year: 2009,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title b.c".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track b.c.1".to_string(), title: "track b.c.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist b.c.1".to_string()], artist: vec!["artist b.c.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -209,9 +214,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track b.c.2".to_string(), title: "track b.c.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist b.c.2.1".to_string(), "artist b.c.2.1".to_string(),
"artist b.c.2.2".to_string(), "artist b.c.2.2".to_string(),
@ -225,19 +230,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title b.d".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2015, year: 2015,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title b.d".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track b.d.1".to_string(), title: "track b.d.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist b.d.1".to_string()], artist: vec!["artist b.d.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -246,9 +252,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track b.d.2".to_string(), title: "track b.d.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist b.d.2.1".to_string(), "artist b.d.2.1".to_string(),
"artist b.d.2.2".to_string(), "artist b.d.2.2".to_string(),
@ -274,19 +280,20 @@ macro_rules! library_collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title c.a".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 1985, year: 1985,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title c.a".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track c.a.1".to_string(), title: "track c.a.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist c.a.1".to_string()], artist: vec!["artist c.a.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -295,9 +302,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track c.a.2".to_string(), title: "track c.a.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist c.a.2.1".to_string(), "artist c.a.2.1".to_string(),
"artist c.a.2.2".to_string(), "artist c.a.2.2".to_string(),
@ -311,19 +318,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title c.b".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2018, year: 2018,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title c.b".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track c.b.1".to_string(), title: "track c.b.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist c.b.1".to_string()], artist: vec!["artist c.b.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -332,9 +340,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track c.b.2".to_string(), title: "track c.b.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist c.b.2.1".to_string(), "artist c.b.2.1".to_string(),
"artist c.b.2.2".to_string(), "artist c.b.2.2".to_string(),
@ -358,19 +366,20 @@ macro_rules! library_collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title d.a".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 1995, year: 1995,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title d.a".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track d.a.1".to_string(), title: "track d.a.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist d.a.1".to_string()], artist: vec!["artist d.a.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -379,9 +388,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track d.a.2".to_string(), title: "track d.a.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist d.a.2.1".to_string(), "artist d.a.2.1".to_string(),
"artist d.a.2.2".to_string(), "artist d.a.2.2".to_string(),
@ -395,19 +404,20 @@ macro_rules! library_collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
title: "album_title d.b".to_string(),
},
date: AlbumDate { date: AlbumDate {
year: 2028, year: 2028,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: "album_title d.b".to_string(), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: "track d.b.1".to_string(), title: "track d.b.1".to_string(),
}, },
number: TrackNum(1),
artist: vec!["artist d.b.1".to_string()], artist: vec!["artist d.b.1".to_string()],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -416,9 +426,9 @@ macro_rules! library_collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: "track d.b.2".to_string(), title: "track d.b.2".to_string(),
}, },
number: TrackNum(2),
artist: vec![ artist: vec![
"artist d.b.2.1".to_string(), "artist d.b.2.1".to_string(),
"artist d.b.2.2".to_string(), "artist d.b.2.2".to_string(),

View File

@ -1,7 +1,7 @@
use std::cmp; use std::cmp;
use musichoard::collection::{ use musichoard::collection::{
album::{Album, AlbumId}, album::{Album, AlbumDate, AlbumId, AlbumSeq},
track::Track, track::Track,
}; };
@ -28,7 +28,7 @@ impl AlbumSelection {
pub fn reinitialise(&mut self, albums: &[Album], album: Option<IdSelectAlbum>) { pub fn reinitialise(&mut self, albums: &[Album], album: Option<IdSelectAlbum>) {
if let Some(album) = album { if let Some(album) = album {
let result = albums.binary_search_by(|a| a.get_sort_key().cmp(&album.album_id)); let result = albums.binary_search_by(|a| a.get_sort_key().cmp(&album.get_sort_key()));
match result { match result {
Ok(index) => self.reinitialise_with_index(albums, index, album.track), Ok(index) => self.reinitialise_with_index(albums, index, album.track),
Err(index) => self.reinitialise_with_index(albums, index, None), Err(index) => self.reinitialise_with_index(albums, index, None),
@ -161,7 +161,7 @@ impl AlbumSelection {
} }
pub struct IdSelectAlbum { pub struct IdSelectAlbum {
album_id: AlbumId, key: (AlbumDate, AlbumSeq, AlbumId),
track: Option<IdSelectTrack>, track: Option<IdSelectTrack>,
} }
@ -169,12 +169,17 @@ impl IdSelectAlbum {
pub fn get(albums: &[Album], selection: &AlbumSelection) -> Option<Self> { pub fn get(albums: &[Album], selection: &AlbumSelection) -> Option<Self> {
selection.state.list.selected().map(|index| { selection.state.list.selected().map(|index| {
let album = &albums[index]; let album = &albums[index];
let key = album.get_sort_key();
IdSelectAlbum { IdSelectAlbum {
album_id: album.get_sort_key().clone(), key: (key.0.to_owned(), key.1.to_owned(), key.2.to_owned()),
track: IdSelectTrack::get(&album.tracks, &selection.track), track: IdSelectTrack::get(&album.tracks, &selection.track),
} }
}) })
} }
pub fn get_sort_key(&self) -> (&AlbumDate, &AlbumSeq, &AlbumId) {
(&self.key.0, &self.key.1, &self.key.2)
}
} }
#[cfg(test)] #[cfg(test)]

View File

@ -1,6 +1,6 @@
use std::cmp; use std::cmp;
use musichoard::collection::track::{Track, TrackId}; use musichoard::collection::track::{Track, TrackId, TrackNum};
use crate::tui::app::selection::{Delta, SelectionState, WidgetState}; use crate::tui::app::selection::{Delta, SelectionState, WidgetState};
@ -20,7 +20,7 @@ impl TrackSelection {
pub fn reinitialise(&mut self, tracks: &[Track], track: Option<IdSelectTrack>) { pub fn reinitialise(&mut self, tracks: &[Track], track: Option<IdSelectTrack>) {
if let Some(track) = track { if let Some(track) = track {
let result = tracks.binary_search_by(|t| t.get_sort_key().cmp(&track.track_id)); let result = tracks.binary_search_by(|t| t.get_sort_key().cmp(&track.get_sort_key()));
match result { match result {
Ok(index) | Err(index) => self.reinitialise_with_index(tracks, index), Ok(index) | Err(index) => self.reinitialise_with_index(tracks, index),
} }
@ -101,18 +101,23 @@ impl TrackSelection {
} }
pub struct IdSelectTrack { pub struct IdSelectTrack {
track_id: TrackId, key: (TrackNum, TrackId),
} }
impl IdSelectTrack { impl IdSelectTrack {
pub fn get(tracks: &[Track], selection: &TrackSelection) -> Option<Self> { pub fn get(tracks: &[Track], selection: &TrackSelection) -> Option<Self> {
selection.state.list.selected().map(|index| { selection.state.list.selected().map(|index| {
let track = &tracks[index]; let track = &tracks[index];
let key = track.get_sort_key();
IdSelectTrack { IdSelectTrack {
track_id: track.get_sort_key().clone(), key: (key.0.to_owned(), key.1.to_owned()),
} }
}) })
} }
pub fn get_sort_key(&self) -> (&TrackNum, &TrackId) {
(&self.key.0, &self.key.1)
}
} }
#[cfg(test)] #[cfg(test)]

View File

@ -1,7 +1,7 @@
use musichoard::collection::{ use musichoard::collection::{
album::{Album, AlbumDate, AlbumId, AlbumMonth}, album::{Album, AlbumDate, AlbumId, AlbumMonth, AlbumSeq},
artist::{Artist, ArtistId, MusicBrainz}, artist::{Artist, ArtistId, MusicBrainz},
track::{Track, TrackFormat, TrackId, TrackQuality}, track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
}; };
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -289,9 +289,7 @@ impl<'a, 'b> AlbumState<'a, 'b> {
"Title: {}\n\ "Title: {}\n\
Year: {}", Year: {}",
album.map(|a| a.id.title.as_str()).unwrap_or(""), album.map(|a| a.id.title.as_str()).unwrap_or(""),
album album.map(|a| a.date.year.to_string()).unwrap_or_default(),
.map(|a| a.id.date.year.to_string())
.unwrap_or_default(),
)); ));
AlbumState { AlbumState {
@ -325,7 +323,7 @@ impl<'a, 'b> TrackState<'a, 'b> {
Title: {}\n\ Title: {}\n\
Artist: {}\n\ Artist: {}\n\
Quality: {}", Quality: {}",
track.map(|t| t.id.number.to_string()).unwrap_or_default(), track.map(|t| t.number.0.to_string()).unwrap_or_default(),
track.map(|t| t.id.title.as_str()).unwrap_or(""), track.map(|t| t.id.title.as_str()).unwrap_or(""),
track.map(|t| t.artist.join("; ")).unwrap_or_default(), track.map(|t| t.artist.join("; ")).unwrap_or_default(),
track track

View File

@ -2,9 +2,9 @@ use once_cell::sync::Lazy;
use std::collections::HashMap; use std::collections::HashMap;
use musichoard::collection::{ use musichoard::collection::{
album::{Album, AlbumDate, AlbumId, AlbumMonth}, album::{Album, AlbumDate, AlbumId, AlbumMonth, AlbumSeq},
artist::{Artist, ArtistId, MusicBrainz}, artist::{Artist, ArtistId, MusicBrainz},
track::{Track, TrackFormat, TrackId, TrackQuality}, track::{Track, TrackFormat, TrackId, TrackNum, TrackQuality},
Collection, Collection,
}; };
@ -33,19 +33,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
]), ]),
albums: vec![Album { albums: vec![Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Slovo"),
},
date: AlbumDate {
year: 2011, year: 2011,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Slovo"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Az"), title: String::from("Az"),
}, },
number: TrackNum(1),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -54,9 +55,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Arkaim"), title: String::from("Arkaim"),
}, },
number: TrackNum(2),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -65,9 +66,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("Bolno mne"), title: String::from("Bolno mne"),
}, },
number: TrackNum(3),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -76,9 +77,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Leshiy"), title: String::from("Leshiy"),
}, },
number: TrackNum(4),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -87,9 +88,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("Zakliatie"), title: String::from("Zakliatie"),
}, },
number: TrackNum(5),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -98,9 +99,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Predok"), title: String::from("Predok"),
}, },
number: TrackNum(6),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -109,9 +110,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("Nikogda"), title: String::from("Nikogda"),
}, },
number: TrackNum(7),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -120,9 +121,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 8,
title: String::from("Tam za tumanami"), title: String::from("Tam za tumanami"),
}, },
number: TrackNum(8),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -131,9 +132,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 9,
title: String::from("Potomok"), title: String::from("Potomok"),
}, },
number: TrackNum(9),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -142,9 +143,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 10,
title: String::from("Slovo"), title: String::from("Slovo"),
}, },
number: TrackNum(10),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -153,9 +154,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 11,
title: String::from("Odna"), title: String::from("Odna"),
}, },
number: TrackNum(11),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -164,9 +165,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 12,
title: String::from("Vo moiom sadochke…"), title: String::from("Vo moiom sadochke…"),
}, },
number: TrackNum(12),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -175,9 +176,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 13,
title: String::from("Stenka na stenku"), title: String::from("Stenka na stenku"),
}, },
number: TrackNum(13),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -186,9 +187,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 14,
title: String::from("Zimushka"), title: String::from("Zimushka"),
}, },
number: TrackNum(14),
artist: vec![String::from("Аркона")], artist: vec![String::from("Аркона")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -217,19 +218,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Vên [rerecorded]"),
},
date: AlbumDate {
year: 2004, year: 2004,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Vên [rerecorded]"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Verja Urit an Bitus"), title: String::from("Verja Urit an Bitus"),
}, },
number: TrackNum(1),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -238,9 +240,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Uis Elveti"), title: String::from("Uis Elveti"),
}, },
number: TrackNum(2),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -249,9 +251,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("Ôrô"), title: String::from("Ôrô"),
}, },
number: TrackNum(3),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -260,9 +262,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Lament"), title: String::from("Lament"),
}, },
number: TrackNum(4),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -271,9 +273,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("Druid"), title: String::from("Druid"),
}, },
number: TrackNum(5),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -282,9 +284,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Jêzaïg"), title: String::from("Jêzaïg"),
}, },
number: TrackNum(6),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -295,19 +297,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Slania"),
},
date: AlbumDate {
year: 2008, year: 2008,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Slania"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Samon"), title: String::from("Samon"),
}, },
number: TrackNum(1),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -316,9 +319,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Primordial Breath"), title: String::from("Primordial Breath"),
}, },
number: TrackNum(2),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -327,9 +330,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("Inis Mona"), title: String::from("Inis Mona"),
}, },
number: TrackNum(3),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -338,9 +341,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Gray Sublime Archon"), title: String::from("Gray Sublime Archon"),
}, },
number: TrackNum(4),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -349,9 +352,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("Anagantios"), title: String::from("Anagantios"),
}, },
number: TrackNum(5),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -360,9 +363,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Bloodstained Ground"), title: String::from("Bloodstained Ground"),
}, },
number: TrackNum(6),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -371,9 +374,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("The Somber Lay"), title: String::from("The Somber Lay"),
}, },
number: TrackNum(7),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -382,9 +385,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 8,
title: String::from("Slanias Song"), title: String::from("Slanias Song"),
}, },
number: TrackNum(8),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -393,9 +396,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 9,
title: String::from("Giamonios"), title: String::from("Giamonios"),
}, },
number: TrackNum(9),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -404,9 +407,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 10,
title: String::from("Tarvos"), title: String::from("Tarvos"),
}, },
number: TrackNum(10),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -415,9 +418,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 11,
title: String::from("Calling the Rain"), title: String::from("Calling the Rain"),
}, },
number: TrackNum(11),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -426,9 +429,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 12,
title: String::from("Elembivos"), title: String::from("Elembivos"),
}, },
number: TrackNum(12),
artist: vec![String::from("Eluveitie")], artist: vec![String::from("Eluveitie")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -457,19 +460,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
]), ]),
albums: vec![Album { albums: vec![Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"),
},
date: AlbumDate {
year: 2001, year: 2001,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Intro = Chaos"), title: String::from("Intro = Chaos"),
}, },
number: TrackNum(1),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -478,9 +482,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Modlitwa"), title: String::from("Modlitwa"),
}, },
number: TrackNum(2),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -489,9 +493,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("Długa droga z piekła"), title: String::from("Długa droga z piekła"),
}, },
number: TrackNum(3),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -500,9 +504,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Synowie ognia"), title: String::from("Synowie ognia"),
}, },
number: TrackNum(4),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -511,9 +515,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("1902"), title: String::from("1902"),
}, },
number: TrackNum(5),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -522,9 +526,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Krew za krew"), title: String::from("Krew za krew"),
}, },
number: TrackNum(6),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -533,9 +537,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("Kulminacja"), title: String::from("Kulminacja"),
}, },
number: TrackNum(7),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -544,9 +548,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 8,
title: String::from("Judasz"), title: String::from("Judasz"),
}, },
number: TrackNum(8),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -555,9 +559,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 9,
title: String::from("Więzy"), title: String::from("Więzy"),
}, },
number: TrackNum(9),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -566,9 +570,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 10,
title: String::from("Zagubione dusze"), title: String::from("Zagubione dusze"),
}, },
number: TrackNum(10),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -577,9 +581,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 11,
title: String::from("Linia życia"), title: String::from("Linia życia"),
}, },
number: TrackNum(11),
artist: vec![String::from("Frontside")], artist: vec![String::from("Frontside")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -609,19 +613,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
]), ]),
albums: vec![Album { albums: vec![Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Paper Plague"),
},
date: AlbumDate {
year: 2011, year: 2011,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Paper Plague"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 0,
title: String::from("Paper Plague"), title: String::from("Paper Plague"),
}, },
number: TrackNum(0),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -631,19 +636,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
], ],
}, Album { }, Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Unbreakable"),
},
date: AlbumDate {
year: 2011, year: 2011,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Unbreakable"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Unbreakable"), title: String::from("Unbreakable"),
}, },
number: TrackNum(1),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -652,9 +658,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Guilt Trips and Sins"), title: String::from("Guilt Trips and Sins"),
}, },
number: TrackNum(2),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -663,9 +669,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("The Long Goodbye"), title: String::from("The Long Goodbye"),
}, },
number: TrackNum(3),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -674,9 +680,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Close Encounters"), title: String::from("Close Encounters"),
}, },
number: TrackNum(4),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -685,9 +691,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("Paranoia"), title: String::from("Paranoia"),
}, },
number: TrackNum(5),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -696,9 +702,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Let Me Out of Here"), title: String::from("Let Me Out of Here"),
}, },
number: TrackNum(6),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -707,9 +713,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("Leeches"), title: String::from("Leeches"),
}, },
number: TrackNum(7),
artist: vec![String::from("Heavens Basement")], artist: vec![String::from("Heavens Basement")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Mp3, format: TrackFormat::Mp3,
@ -738,19 +744,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
albums: vec![ albums: vec![
Album { Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("Ride the Lightning"),
},
date: AlbumDate {
year: 1984, year: 1984,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("Ride the Lightning"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("Fight Fire with Fire"), title: String::from("Fight Fire with Fire"),
}, },
number: TrackNum(1),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -759,9 +766,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("Ride the Lightning"), title: String::from("Ride the Lightning"),
}, },
number: TrackNum(2),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -770,9 +777,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("For Whom the Bell Tolls"), title: String::from("For Whom the Bell Tolls"),
}, },
number: TrackNum(3),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -781,9 +788,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Fade to Black"), title: String::from("Fade to Black"),
}, },
number: TrackNum(4),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -792,9 +799,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("Trapped under Ice"), title: String::from("Trapped under Ice"),
}, },
number: TrackNum(5),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -803,9 +810,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Escape"), title: String::from("Escape"),
}, },
number: TrackNum(6),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -814,9 +821,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("Creeping Death"), title: String::from("Creeping Death"),
}, },
number: TrackNum(7),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -825,9 +832,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 8,
title: String::from("The Call of Ktulu"), title: String::from("The Call of Ktulu"),
}, },
number: TrackNum(8),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -838,19 +845,20 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Album { Album {
id: AlbumId { id: AlbumId {
date: AlbumDate{ title: String::from("S&M"),
},
date: AlbumDate {
year: 1999, year: 1999,
month: AlbumMonth::None, month: AlbumMonth::None,
day: 0, day: 0,
}, },
title: String::from("S&M"), seq: AlbumSeq(0),
},
tracks: vec![ tracks: vec![
Track { Track {
id: TrackId { id: TrackId {
number: 1,
title: String::from("The Ecstasy of Gold"), title: String::from("The Ecstasy of Gold"),
}, },
number: TrackNum(1),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -859,9 +867,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 2,
title: String::from("The Call of Ktulu"), title: String::from("The Call of Ktulu"),
}, },
number: TrackNum(2),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -870,9 +878,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 3,
title: String::from("Master of Puppets"), title: String::from("Master of Puppets"),
}, },
number: TrackNum(3),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -881,9 +889,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 4,
title: String::from("Of Wolf and Man"), title: String::from("Of Wolf and Man"),
}, },
number: TrackNum(4),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -892,9 +900,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 5,
title: String::from("The Thing That Should Not Be"), title: String::from("The Thing That Should Not Be"),
}, },
number: TrackNum(5),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -903,9 +911,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 6,
title: String::from("Fuel"), title: String::from("Fuel"),
}, },
number: TrackNum(6),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -914,9 +922,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 7,
title: String::from("The Memory Remains"), title: String::from("The Memory Remains"),
}, },
number: TrackNum(7),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -925,9 +933,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 8,
title: String::from("No Leaf Clover"), title: String::from("No Leaf Clover"),
}, },
number: TrackNum(8),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -936,9 +944,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 9,
title: String::from("Hero of the Day"), title: String::from("Hero of the Day"),
}, },
number: TrackNum(9),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -947,9 +955,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 10,
title: String::from("Devils Dance"), title: String::from("Devils Dance"),
}, },
number: TrackNum(10),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -958,9 +966,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 11,
title: String::from("Bleeding Me"), title: String::from("Bleeding Me"),
}, },
number: TrackNum(11),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -969,9 +977,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 12,
title: String::from("Nothing Else Matters"), title: String::from("Nothing Else Matters"),
}, },
number: TrackNum(12),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -980,9 +988,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 13,
title: String::from("Until It Sleeps"), title: String::from("Until It Sleeps"),
}, },
number: TrackNum(13),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -991,9 +999,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 14,
title: String::from("For Whom the Bell Tolls"), title: String::from("For Whom the Bell Tolls"),
}, },
number: TrackNum(14),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1002,9 +1010,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 15,
title: String::from("Human"), title: String::from("Human"),
}, },
number: TrackNum(15),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1013,9 +1021,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 16,
title: String::from("Wherever I May Roam"), title: String::from("Wherever I May Roam"),
}, },
number: TrackNum(16),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1024,9 +1032,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 17,
title: String::from("Outlaw Torn"), title: String::from("Outlaw Torn"),
}, },
number: TrackNum(17),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1035,9 +1043,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 18,
title: String::from("Sad but True"), title: String::from("Sad but True"),
}, },
number: TrackNum(18),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1046,9 +1054,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 19,
title: String::from("One"), title: String::from("One"),
}, },
number: TrackNum(19),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1057,9 +1065,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 20,
title: String::from("Enter Sandman"), title: String::from("Enter Sandman"),
}, },
number: TrackNum(20),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,
@ -1068,9 +1076,9 @@ pub static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| -> Collection {
}, },
Track { Track {
id: TrackId { id: TrackId {
number: 21,
title: String::from("Battery"), title: String::from("Battery"),
}, },
number: TrackNum(21),
artist: vec![String::from("Metallica")], artist: vec![String::from("Metallica")],
quality: TrackQuality { quality: TrackQuality {
format: TrackFormat::Flac, format: TrackFormat::Flac,