Add a TrackId

This commit is contained in:
Wojciech Kozlowski 2023-05-14 19:26:50 +02:00
parent cc4e59a76e
commit 970a7786e9
7 changed files with 394 additions and 207 deletions

View File

@ -73,8 +73,8 @@ mod tests {
let mut tracks: Vec<String> = vec![];
for track in album.tracks.iter() {
let track_number = track.number;
let track_title = &track.title;
let track_number = track.id.number;
let track_title = &track.id.title;
let mut track_artist: Vec<String> = vec![];
for artist in track.artist.iter() {
@ -89,8 +89,7 @@ mod tests {
tracks.push(format!(
"{{\
\"number\":{track_number},\
\"title\":\"{track_title}\",\
\"id\":{{\"number\":{track_number},\"title\":\"{track_title}\"}},\
\"artist\":[{track_artist}],\
\"quality\":{{\"format\":\"{track_format}\",\"bitrate\":{track_bitrate}}}\
}}"

View File

@ -30,28 +30,30 @@ pub struct Quality {
pub bitrate: u32,
}
/// The track identifier.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TrackId {
pub number: u32,
pub title: String,
}
/// A single track on an album.
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
pub struct Track {
pub number: u32,
pub title: String,
pub id: TrackId,
pub artist: Vec<String>,
pub quality: Quality,
}
impl PartialOrd for Track {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
let id = (&self.number, &self.title);
let other_id = (&other.number, &other.title);
id.partial_cmp(&other_id)
self.id.partial_cmp(&other.id)
}
}
impl Ord for Track {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
let id = (&self.number, &self.title);
let other_id = (&other.number, &other.title);
id.cmp(&other_id)
self.id.cmp(&other.id)
}
}
@ -200,8 +202,10 @@ impl<LIB: ILibrary, DB: IDatabase> MusicHoard<LIB, DB> {
};
let track = Track {
number: item.track_number,
title: item.track_title,
id: TrackId {
number: item.track_number,
title: item.track_title,
},
artist: item.track_artist,
quality: Quality {
format: item.track_format,
@ -278,8 +282,8 @@ mod tests {
album_artist: artist.id.name.clone(),
album_year: album.id.year,
album_title: album.id.title.clone(),
track_number: track.number,
track_title: track.title.clone(),
track_number: track.id.number,
track_title: track.id.title.clone(),
track_artist: track.artist.clone(),
track_format: track.quality.format,
track_bitrate: track.quality.bitrate,

View File

@ -13,8 +13,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track a.a.1".to_string(),
id: TrackId{
number: 1,
title: "track a.a.1".to_string(),
},
artist: vec!["artist a.a.1".to_string()],
quality: Quality {
format: Format::Flac,
@ -22,8 +24,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track a.a.2".to_string(),
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(),
@ -34,8 +38,10 @@ macro_rules! collection {
},
},
Track {
number: 3,
title: "track a.a.3".to_string(),
id: TrackId{
number: 3,
title: "track a.a.3".to_string(),
},
artist: vec!["artist a.a.3".to_string()],
quality: Quality {
format: Format::Flac,
@ -51,8 +57,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track a.b.1".to_string(),
id: TrackId{
number: 1,
title: "track a.b.1".to_string(),
},
artist: vec!["artist a.b.1".to_string()],
quality: Quality {
format: Format::Flac,
@ -60,8 +68,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track a.b.2".to_string(),
id: TrackId{
number: 2,
title: "track a.b.2".to_string(),
},
artist: vec!["artist a.b.2".to_string()],
quality: Quality {
format: Format::Flac,
@ -84,8 +94,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track b.a.1".to_string(),
id: TrackId{
number: 1,
title: "track b.a.1".to_string(),
},
artist: vec!["artist b.a.1".to_string()],
quality: Quality {
format: Format::Mp3,
@ -93,8 +105,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track b.a.2".to_string(),
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(),
@ -113,8 +127,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track b.b.1".to_string(),
id: TrackId{
number: 1,
title: "track b.b.1".to_string(),
},
artist: vec!["artist b.b.1".to_string()],
quality: Quality {
format: Format::Flac,
@ -122,8 +138,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track b.b.2".to_string(),
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(),
@ -149,8 +167,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track c.a.1".to_string(),
id: TrackId{
number: 1,
title: "track c.a.1".to_string(),
},
artist: vec!["artist c.a.1".to_string()],
quality: Quality {
format: Format::Mp3,
@ -158,8 +178,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track c.a.2".to_string(),
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(),
@ -178,8 +200,10 @@ macro_rules! collection {
},
tracks: vec![
Track {
number: 1,
title: "track c.b.1".to_string(),
id: TrackId{
number: 1,
title: "track c.b.1".to_string(),
},
artist: vec!["artist c.b.1".to_string()],
quality: Quality {
format: Format::Flac,
@ -187,8 +211,10 @@ macro_rules! collection {
},
},
Track {
number: 2,
title: "track c.b.2".to_string(),
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(),

View File

@ -404,7 +404,7 @@ impl<'a, 'b> TrackState<'a, 'b> {
let list = List::new(
tracks
.iter()
.map(|id| ListItem::new(id.title.as_str()))
.map(|tr| ListItem::new(tr.id.title.as_str()))
.collect::<Vec<ListItem>>(),
);
@ -415,9 +415,9 @@ impl<'a, 'b> TrackState<'a, 'b> {
Artist: {}\n\
Quality: {}",
track
.map(|t| t.number.to_string())
.map(|t| t.id.number.to_string())
.unwrap_or_else(|| "".to_string()),
track.map(|t| t.title.as_str()).unwrap_or(""),
track.map(|t| t.id.title.as_str()).unwrap_or(""),
track
.map(|t| t.artist.join("; "))
.unwrap_or_else(|| "".to_string()),

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
mod database;
mod library;
use musichoard::{Album, AlbumId, Artist, ArtistId, Format, Quality, Track};
use musichoard::{Album, AlbumId, Artist, ArtistId, Format, Quality, Track, TrackId};
use once_cell::sync::Lazy;
static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
@ -17,8 +17,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Az"),
id: TrackId {
number: 01,
title: String::from("Az"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -26,8 +28,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Arkaim"),
id: TrackId {
number: 02,
title: String::from("Arkaim"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -35,8 +39,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("Bolno mne"),
id: TrackId {
number: 03,
title: String::from("Bolno mne"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -44,8 +50,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Leshiy"),
id: TrackId{
number: 04,
title: String::from("Leshiy"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -53,8 +61,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("Zakliatie"),
id: TrackId{
number: 05,
title: String::from("Zakliatie"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -62,8 +72,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Predok"),
id: TrackId{
number: 06,
title: String::from("Predok"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -71,8 +83,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("Nikogda"),
id: TrackId{
number: 07,
title: String::from("Nikogda"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -80,8 +94,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 08,
title: String::from("Tam za tumanami"),
id: TrackId{
number: 08,
title: String::from("Tam za tumanami"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -89,8 +105,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 09,
title: String::from("Potomok"),
id: TrackId{
number: 09,
title: String::from("Potomok"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -98,8 +116,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 10,
title: String::from("Slovo"),
id: TrackId{
number: 10,
title: String::from("Slovo"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -107,8 +127,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 11,
title: String::from("Odna"),
id: TrackId{
number: 11,
title: String::from("Odna"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -116,8 +138,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 12,
title: String::from("Vo moiom sadochke…"),
id: TrackId{
number: 12,
title: String::from("Vo moiom sadochke…"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -125,8 +149,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 13,
title: String::from("Stenka na stenku"),
id: TrackId{
number: 13,
title: String::from("Stenka na stenku"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -134,8 +160,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 14,
title: String::from("Zimushka"),
id: TrackId{
number: 14,
title: String::from("Zimushka"),
},
artist: vec![String::from("Аркона")],
quality: Quality {
format: Format::Flac,
@ -157,8 +185,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Samon"),
id: TrackId{
number: 01,
title: String::from("Samon"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -166,8 +196,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Primordial Breath"),
id: TrackId{
number: 02,
title: String::from("Primordial Breath"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -175,8 +207,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("Inis Mona"),
id: TrackId{
number: 03,
title: String::from("Inis Mona"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -184,8 +218,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Gray Sublime Archon"),
id: TrackId{
number: 04,
title: String::from("Gray Sublime Archon"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -193,8 +229,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("Anagantios"),
id: TrackId{
number: 05,
title: String::from("Anagantios"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -202,8 +240,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Bloodstained Ground"),
id: TrackId{
number: 06,
title: String::from("Bloodstained Ground"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -211,8 +251,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("The Somber Lay"),
id: TrackId{
number: 07,
title: String::from("The Somber Lay"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -220,8 +262,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 08,
title: String::from("Slanias Song"),
id: TrackId{
number: 08,
title: String::from("Slanias Song"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -229,8 +273,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 09,
title: String::from("Giamonios"),
id: TrackId{
number: 09,
title: String::from("Giamonios"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -238,8 +284,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 10,
title: String::from("Tarvos"),
id: TrackId{
number: 10,
title: String::from("Tarvos"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -247,8 +295,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 11,
title: String::from("Calling the Rain"),
id: TrackId{
number: 11,
title: String::from("Calling the Rain"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -256,8 +306,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 12,
title: String::from("Elembivos"),
id: TrackId{
number: 12,
title: String::from("Elembivos"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -273,8 +325,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Verja Urit an Bitus"),
id: TrackId{
number: 01,
title: String::from("Verja Urit an Bitus"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -282,8 +336,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Uis Elveti"),
id: TrackId{
number: 02,
title: String::from("Uis Elveti"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -291,8 +347,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("Ôrô"),
id: TrackId{
number: 03,
title: String::from("Ôrô"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -300,8 +358,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Lament"),
id: TrackId{
number: 04,
title: String::from("Lament"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -309,8 +369,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("Druid"),
id: TrackId{
number: 05,
title: String::from("Druid"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -318,8 +380,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Jêzaïg"),
id: TrackId{
number: 06,
title: String::from("Jêzaïg"),
},
artist: vec![String::from("Eluveitie")],
quality: Quality {
format: Format::Flac,
@ -341,8 +405,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Intro = Chaos"),
id: TrackId{
number: 01,
title: String::from("Intro = Chaos"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -350,8 +416,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Modlitwa"),
id: TrackId{
number: 02,
title: String::from("Modlitwa"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -359,8 +427,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("Długa droga z piekła"),
id: TrackId{
number: 03,
title: String::from("Długa droga z piekła"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -368,8 +438,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Synowie ognia"),
id: TrackId{
number: 04,
title: String::from("Synowie ognia"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -377,8 +449,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("1902"),
id: TrackId{
number: 05,
title: String::from("1902"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -386,8 +460,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Krew za krew"),
id: TrackId{
number: 06,
title: String::from("Krew za krew"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -395,8 +471,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("Kulminacja"),
id: TrackId{
number: 07,
title: String::from("Kulminacja"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -404,8 +482,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 08,
title: String::from("Judasz"),
id: TrackId{
number: 08,
title: String::from("Judasz"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -413,8 +493,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 09,
title: String::from("Więzy"),
id: TrackId{
number: 09,
title: String::from("Więzy"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -422,8 +504,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 10,
title: String::from("Zagubione dusze"),
id: TrackId{
number: 10,
title: String::from("Zagubione dusze"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -431,8 +515,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 11,
title: String::from("Linia życia"),
id: TrackId{
number: 11,
title: String::from("Linia życia"),
},
artist: vec![String::from("Frontside")],
quality: Quality {
format: Format::Flac,
@ -453,8 +539,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Unbreakable"),
id: TrackId{
number: 01,
title: String::from("Unbreakable"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -462,8 +550,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Guilt Trips and Sins"),
id: TrackId{
number: 02,
title: String::from("Guilt Trips and Sins"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -471,8 +561,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("The Long Goodbye"),
id: TrackId{
number: 03,
title: String::from("The Long Goodbye"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -480,8 +572,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Close Encounters"),
id: TrackId{
number: 04,
title: String::from("Close Encounters"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -489,8 +583,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("Paranoia"),
id: TrackId{
number: 05,
title: String::from("Paranoia"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -498,8 +594,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Let Me Out of Here"),
id: TrackId{
number: 06,
title: String::from("Let Me Out of Here"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -507,8 +605,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("Leeches"),
id: TrackId{
number: 07,
title: String::from("Leeches"),
},
artist: vec![String::from("Heavens Basement")],
quality: Quality {
format: Format::Mp3,
@ -530,8 +630,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("Fight Fire with Fire"),
id: TrackId{
number: 01,
title: String::from("Fight Fire with Fire"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -539,8 +641,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("Ride the Lightning"),
id: TrackId{
number: 02,
title: String::from("Ride the Lightning"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -548,8 +652,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("For Whom the Bell Tolls"),
id: TrackId{
number: 03,
title: String::from("For Whom the Bell Tolls"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -557,8 +663,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Fade to Black"),
id: TrackId{
number: 04,
title: String::from("Fade to Black"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -566,8 +674,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("Trapped under Ice"),
id: TrackId{
number: 05,
title: String::from("Trapped under Ice"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -575,8 +685,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Escape"),
id: TrackId{
number: 06,
title: String::from("Escape"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -584,8 +696,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("Creeping Death"),
id: TrackId{
number: 07,
title: String::from("Creeping Death"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -593,8 +707,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 08,
title: String::from("The Call of Ktulu"),
id: TrackId{
number: 08,
title: String::from("The Call of Ktulu"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -610,8 +726,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
tracks: vec![
Track {
number: 01,
title: String::from("The Ecstasy of Gold"),
id: TrackId{
number: 01,
title: String::from("The Ecstasy of Gold"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -619,8 +737,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 02,
title: String::from("The Call of Ktulu"),
id: TrackId{
number: 02,
title: String::from("The Call of Ktulu"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -628,8 +748,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 03,
title: String::from("Master of Puppets"),
id: TrackId{
number: 03,
title: String::from("Master of Puppets"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -637,8 +759,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 04,
title: String::from("Of Wolf and Man"),
id: TrackId{
number: 04,
title: String::from("Of Wolf and Man"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -646,8 +770,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 05,
title: String::from("The Thing That Should Not Be"),
id: TrackId{
number: 05,
title: String::from("The Thing That Should Not Be"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -655,8 +781,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 06,
title: String::from("Fuel"),
id: TrackId{
number: 06,
title: String::from("Fuel"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -664,8 +792,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 07,
title: String::from("The Memory Remains"),
id: TrackId{
number: 07,
title: String::from("The Memory Remains"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -673,8 +803,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 08,
title: String::from("No Leaf Clover"),
id: TrackId{
number: 08,
title: String::from("No Leaf Clover"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -682,8 +814,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 09,
title: String::from("Hero of the Day"),
id: TrackId{
number: 09,
title: String::from("Hero of the Day"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -691,8 +825,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 10,
title: String::from("Devils Dance"),
id: TrackId{
number: 10,
title: String::from("Devils Dance"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -700,8 +836,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 11,
title: String::from("Bleeding Me"),
id: TrackId{
number: 11,
title: String::from("Bleeding Me"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -709,8 +847,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 12,
title: String::from("Nothing Else Matters"),
id: TrackId{
number: 12,
title: String::from("Nothing Else Matters"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -718,8 +858,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 13,
title: String::from("Until It Sleeps"),
id: TrackId{
number: 13,
title: String::from("Until It Sleeps"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -727,8 +869,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 14,
title: String::from("For Whom the Bell Tolls"),
id: TrackId{
number: 14,
title: String::from("For Whom the Bell Tolls"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -736,8 +880,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 15,
title: String::from("Human"),
id: TrackId{
number: 15,
title: String::from("Human"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -745,8 +891,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 16,
title: String::from("Wherever I May Roam"),
id: TrackId{
number: 16,
title: String::from("Wherever I May Roam"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -754,8 +902,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 17,
title: String::from("Outlaw Torn"),
id: TrackId{
number: 17,
title: String::from("Outlaw Torn"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -763,8 +913,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 18,
title: String::from("Sad but True"),
id: TrackId{
number: 18,
title: String::from("Sad but True"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -772,8 +924,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 19,
title: String::from("One"),
id: TrackId{
number: 19,
title: String::from("One"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -781,8 +935,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 20,
title: String::from("Enter Sandman"),
id: TrackId{
number: 20,
title: String::from("Enter Sandman"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,
@ -790,8 +946,10 @@ static COLLECTION: Lazy<Vec<Artist>> = Lazy::new(|| {
},
},
Track {
number: 21,
title: String::from("Battery"),
id: TrackId{
number: 21,
title: String::from("Battery"),
},
artist: vec![String::from("Metallica")],
quality: Quality {
format: Format::Flac,

View File

@ -41,8 +41,8 @@ fn artist_to_items(artist: &Artist) -> Vec<Item> {
album_artist: artist.id.name.clone(),
album_year: album.id.year,
album_title: album.id.title.clone(),
track_number: track.number,
track_title: track.title.clone(),
track_number: track.id.number,
track_title: track.id.title.clone(),
track_artist: track.artist.clone(),
track_format: track.quality.format,
track_bitrate: track.quality.bitrate,