diff --git a/src/core/collection/album.rs b/src/core/collection/album.rs index 7a35591..492e320 100644 --- a/src/core/collection/album.rs +++ b/src/core/collection/album.rs @@ -15,10 +15,56 @@ pub struct Album { /// The album identifier. #[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] pub struct AlbumId { - pub year: u32, + pub date: AlbumDate, pub title: String, } +// There are crates for handling dates, but we don't need much complexity beyond year-month-day. +#[derive(Clone, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] +pub struct AlbumDate { + pub year: u32, + pub month: AlbumMonth, + pub day: u8, +} + +#[repr(u8)] +#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Ord, Eq, Hash)] +pub enum AlbumMonth { + None = 0, + January = 1, + February = 2, + March = 3, + April = 4, + May = 5, + June = 6, + July = 7, + August = 8, + September = 9, + October = 10, + November = 11, + December = 12, +} + +impl From for AlbumMonth { + fn from(value: u8) -> Self { + match value { + 1 => AlbumMonth::January, + 2 => AlbumMonth::February, + 3 => AlbumMonth::March, + 4 => AlbumMonth::April, + 5 => AlbumMonth::May, + 6 => AlbumMonth::June, + 7 => AlbumMonth::July, + 8 => AlbumMonth::August, + 9 => AlbumMonth::September, + 10 => AlbumMonth::October, + 11 => AlbumMonth::November, + 12 => AlbumMonth::December, + _ => AlbumMonth::None, + } + } +} + impl Album { pub fn get_sort_key(&self) -> &AlbumId { &self.id @@ -51,6 +97,25 @@ mod tests { use super::*; + #[test] + fn album_month() { + assert_eq!(>::into(0), AlbumMonth::None); + assert_eq!(>::into(1), AlbumMonth::January); + assert_eq!(>::into(2), AlbumMonth::February); + assert_eq!(>::into(3), AlbumMonth::March); + assert_eq!(>::into(4), AlbumMonth::April); + assert_eq!(>::into(5), AlbumMonth::May); + assert_eq!(>::into(6), AlbumMonth::June); + assert_eq!(>::into(7), AlbumMonth::July); + assert_eq!(>::into(8), AlbumMonth::August); + assert_eq!(>::into(9), AlbumMonth::September); + assert_eq!(>::into(10), AlbumMonth::October); + assert_eq!(>::into(11), AlbumMonth::November); + assert_eq!(>::into(12), AlbumMonth::December); + assert_eq!(>::into(13), AlbumMonth::None); + assert_eq!(>::into(255), AlbumMonth::None); + } + #[test] fn merge_album_no_overlap() { let left = FULL_COLLECTION[0].albums[0].to_owned(); diff --git a/src/core/collection/track.rs b/src/core/collection/track.rs index 5853de1..2aa5aa1 100644 --- a/src/core/collection/track.rs +++ b/src/core/collection/track.rs @@ -5,7 +5,7 @@ use crate::core::collection::merge::Merge; pub struct Track { pub id: TrackId, pub artist: Vec, - pub quality: Quality, + pub quality: TrackQuality, } /// The track identifier. @@ -17,8 +17,8 @@ pub struct TrackId { /// The track quality. Combines format and bitrate information. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -pub struct Quality { - pub format: Format, +pub struct TrackQuality { + pub format: TrackFormat, pub bitrate: u32, } @@ -30,7 +30,7 @@ impl Track { /// The track file format. #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub enum Format { +pub enum TrackFormat { Flac, Mp3, } @@ -65,16 +65,16 @@ mod tests { title: String::from("a title"), }, artist: vec![String::from("left artist")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1411, }, }; let right = Track { id: left.id.clone(), artist: vec![String::from("right artist")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 320, }, }; diff --git a/src/core/library/beets/mod.rs b/src/core/library/beets/mod.rs index 748a3c6..53a1ac1 100644 --- a/src/core/library/beets/mod.rs +++ b/src/core/library/beets/mod.rs @@ -7,7 +7,7 @@ pub mod executor; use mockall::automock; use crate::core::{ - collection::track::Format, + collection::track::TrackFormat, library::{Error, Field, ILibrary, Item, Query}, }; @@ -27,6 +27,10 @@ const LIST_FORMAT_ARG: &str = concat!( list_format_separator!(), "$year", list_format_separator!(), + "$month", + list_format_separator!(), + "$day", + list_format_separator!(), "$album", list_format_separator!(), "$track", @@ -42,6 +46,21 @@ const LIST_FORMAT_ARG: &str = concat!( const TRACK_FORMAT_FLAC: &str = "FLAC"; const TRACK_FORMAT_MP3: &str = "MP3"; +fn format_to_str(format: &TrackFormat) -> &'static str { + match format { + TrackFormat::Flac => TRACK_FORMAT_FLAC, + TrackFormat::Mp3 => TRACK_FORMAT_MP3, + } +} + +fn str_to_format(format: &str) -> Option { + match format { + TRACK_FORMAT_FLAC => Some(TrackFormat::Flac), + TRACK_FORMAT_MP3 => Some(TrackFormat::Mp3), + _ => None, + } +} + trait ToBeetsArg { fn to_arg(&self, include: bool) -> String; } @@ -57,10 +76,13 @@ impl ToBeetsArg for Field { Field::AlbumArtist(ref s) => format!("{negate}albumartist:{s}"), Field::AlbumArtistSort(ref s) => format!("{negate}albumartist_sort:{s}"), Field::AlbumYear(ref u) => format!("{negate}year:{u}"), + Field::AlbumMonth(ref e) => format!("{negate}month:{}", *e as u8), + Field::AlbumDay(ref u) => format!("{negate}day:{u}"), Field::AlbumTitle(ref s) => format!("{negate}album:{s}"), Field::TrackNumber(ref u) => format!("{negate}track:{u}"), Field::TrackTitle(ref s) => format!("{negate}title:{s}"), Field::TrackArtist(ref v) => format!("{negate}artist:{}", v.join("; ")), + Field::TrackFormat(ref f) => format!("{negate}format:{}", format_to_str(f)), Field::All(ref s) => format!("{negate}{s}"), } } @@ -127,36 +149,38 @@ impl ILibraryPrivate for BeetsLibrary { } let split: Vec<&str> = line.split(LIST_FORMAT_SEPARATOR).collect(); - if split.len() != 9 { + if split.len() != 11 { return Err(Error::Invalid(line.to_string())); } let album_artist = split[0].to_string(); - let album_artist_sort = if !split[1].is_empty() { - Some(split[1].to_string()) - } else { - None + let album_artist_sort = match !split[1].is_empty() { + true => Some(split[1].to_string()), + false => None, }; let album_year = split[2].parse::()?; - let album_title = split[3].to_string(); - let track_number = split[4].parse::()?; - let track_title = split[5].to_string(); - let track_artist = split[6] + let album_month = split[3].parse::()?.into(); + let album_day = split[4].parse::()?; + let album_title = split[5].to_string(); + let track_number = split[6].parse::()?; + let track_title = split[7].to_string(); + let track_artist = split[8] .to_string() .split("; ") .map(|s| s.to_owned()) .collect(); - let track_format = match split[7].to_string().as_str() { - TRACK_FORMAT_FLAC => Format::Flac, - TRACK_FORMAT_MP3 => Format::Mp3, - _ => return Err(Error::Invalid(line.to_string())), + let track_format = match str_to_format(split[9].to_string().as_str()) { + Some(format) => format, + None => return Err(Error::Invalid(line.to_string())), }; - let track_bitrate = split[8].trim_end_matches("kbps").parse::()?; + let track_bitrate = split[10].trim_end_matches("kbps").parse::()?; items.push(Item { album_artist, album_artist_sort, album_year, + album_month, + album_day, album_title, track_number, track_title, @@ -177,7 +201,7 @@ mod testmod; mod tests { use mockall::predicate; - use crate::core::library::testmod::LIBRARY_ITEMS; + use crate::{core::library::testmod::LIBRARY_ITEMS, collection::album::AlbumMonth}; use super::*; use testmod::LIBRARY_BEETS; @@ -191,6 +215,7 @@ mod tests { String::from("some.artist.1"), String::from("some.artist.2"), ])) + .exclude(Field::TrackFormat(TrackFormat::Mp3)) .exclude(Field::All(String::from("some.all"))) .to_args(); query.sort(); @@ -199,6 +224,7 @@ mod tests { query, vec![ String::from("^album:some.album"), + String::from("^format:MP3"), String::from("^some.all"), String::from("artist:some.artist.1; some.artist.2"), String::from("track:5"), @@ -209,7 +235,10 @@ mod tests { .exclude(Field::AlbumArtist(String::from("some.albumartist"))) .exclude(Field::AlbumArtistSort(String::from("some.albumartist"))) .include(Field::AlbumYear(3030)) + .include(Field::AlbumMonth(AlbumMonth::April)) + .include(Field::AlbumDay(6)) .include(Field::TrackTitle(String::from("some.track"))) + .include(Field::TrackFormat(TrackFormat::Flac)) .exclude(Field::TrackArtist(vec![ String::from("some.artist.1"), String::from("some.artist.2"), @@ -223,6 +252,9 @@ mod tests { String::from("^albumartist:some.albumartist"), String::from("^albumartist_sort:some.albumartist"), String::from("^artist:some.artist.1; some.artist.2"), + String::from("day:6"), + String::from("format:FLAC"), + String::from("month:4"), String::from("title:some.track"), String::from("year:3030"), ] @@ -335,8 +367,8 @@ mod tests { .split(LIST_FORMAT_SEPARATOR) .map(|s| s.to_owned()) .collect::>(); - invalid_string[7].clear(); - invalid_string[7].push_str("invalid format"); + invalid_string[9].clear(); + invalid_string[9].push_str("invalid format"); let invalid_string = invalid_string.join(LIST_FORMAT_SEPARATOR); output[2] = invalid_string.clone(); let result = Ok(output); diff --git a/src/core/library/beets/testmod.rs b/src/core/library/beets/testmod.rs index e4f30f9..b0fc10a 100644 --- a/src/core/library/beets/testmod.rs +++ b/src/core/library/beets/testmod.rs @@ -2,27 +2,115 @@ use once_cell::sync::Lazy; pub static LIBRARY_BEETS: Lazy> = Lazy::new(|| -> Vec { vec![ - String::from("Album_Artist ‘A’ -*^- -*^- 1998 -*^- album_title a.a -*^- 1 -*^- track a.a.1 -*^- artist a.a.1 -*^- FLAC -*^- 992"), - String::from("Album_Artist ‘A’ -*^- -*^- 1998 -*^- album_title a.a -*^- 2 -*^- track a.a.2 -*^- artist a.a.2.1; artist a.a.2.2 -*^- MP3 -*^- 320"), - String::from("Album_Artist ‘A’ -*^- -*^- 1998 -*^- album_title a.a -*^- 3 -*^- track a.a.3 -*^- artist a.a.3 -*^- FLAC -*^- 1061"), - String::from("Album_Artist ‘A’ -*^- -*^- 1998 -*^- album_title a.a -*^- 4 -*^- track a.a.4 -*^- artist a.a.4 -*^- FLAC -*^- 1042"), - String::from("Album_Artist ‘A’ -*^- -*^- 2015 -*^- album_title a.b -*^- 1 -*^- track a.b.1 -*^- artist a.b.1 -*^- FLAC -*^- 1004"), - String::from("Album_Artist ‘A’ -*^- -*^- 2015 -*^- album_title a.b -*^- 2 -*^- track a.b.2 -*^- artist a.b.2 -*^- FLAC -*^- 1077"), - String::from("Album_Artist ‘B’ -*^- -*^- 2003 -*^- album_title b.a -*^- 1 -*^- track b.a.1 -*^- artist b.a.1 -*^- MP3 -*^- 190"), - String::from("Album_Artist ‘B’ -*^- -*^- 2003 -*^- album_title b.a -*^- 2 -*^- track b.a.2 -*^- artist b.a.2.1; artist b.a.2.2 -*^- MP3 -*^- 120"), - String::from("Album_Artist ‘B’ -*^- -*^- 2008 -*^- album_title b.b -*^- 1 -*^- track b.b.1 -*^- artist b.b.1 -*^- FLAC -*^- 1077"), - String::from("Album_Artist ‘B’ -*^- -*^- 2008 -*^- album_title b.b -*^- 2 -*^- track b.b.2 -*^- artist b.b.2.1; artist b.b.2.2 -*^- MP3 -*^- 320"), - String::from("Album_Artist ‘B’ -*^- -*^- 2009 -*^- album_title b.c -*^- 1 -*^- track b.c.1 -*^- artist b.c.1 -*^- MP3 -*^- 190"), - String::from("Album_Artist ‘B’ -*^- -*^- 2009 -*^- album_title b.c -*^- 2 -*^- track b.c.2 -*^- artist b.c.2.1; artist b.c.2.2 -*^- MP3 -*^- 120"), - String::from("Album_Artist ‘B’ -*^- -*^- 2015 -*^- album_title b.d -*^- 1 -*^- track b.d.1 -*^- artist b.d.1 -*^- MP3 -*^- 190"), - String::from("Album_Artist ‘B’ -*^- -*^- 2015 -*^- album_title b.d -*^- 2 -*^- track b.d.2 -*^- artist b.d.2.1; artist b.d.2.2 -*^- MP3 -*^- 120"), - String::from("The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- 1985 -*^- album_title c.a -*^- 1 -*^- track c.a.1 -*^- artist c.a.1 -*^- MP3 -*^- 320"), - String::from("The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- 1985 -*^- album_title c.a -*^- 2 -*^- track c.a.2 -*^- artist c.a.2.1; artist c.a.2.2 -*^- MP3 -*^- 120"), - String::from("The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- 2018 -*^- album_title c.b -*^- 1 -*^- track c.b.1 -*^- artist c.b.1 -*^- FLAC -*^- 1041"), - String::from("The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- 2018 -*^- album_title c.b -*^- 2 -*^- track c.b.2 -*^- artist c.b.2.1; artist c.b.2.2 -*^- FLAC -*^- 756"), - String::from("Album_Artist ‘D’ -*^- -*^- 1995 -*^- album_title d.a -*^- 1 -*^- track d.a.1 -*^- artist d.a.1 -*^- MP3 -*^- 120"), - String::from("Album_Artist ‘D’ -*^- -*^- 1995 -*^- album_title d.a -*^- 2 -*^- track d.a.2 -*^- artist d.a.2.1; artist d.a.2.2 -*^- MP3 -*^- 120"), - String::from("Album_Artist ‘D’ -*^- -*^- 2028 -*^- album_title d.b -*^- 1 -*^- track d.b.1 -*^- artist d.b.1 -*^- FLAC -*^- 841"), - String::from("Album_Artist ‘D’ -*^- -*^- 2028 -*^- album_title d.b -*^- 2 -*^- track d.b.2 -*^- artist d.b.2.1; artist d.b.2.2 -*^- FLAC -*^- 756") + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 1998 -*^- 00 -*^- 00 -*^- album_title a.a -*^- \ + 1 -*^- track a.a.1 -*^- artist a.a.1 -*^- FLAC -*^- 992", + ), + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 1998 -*^- 00 -*^- 00 -*^- album_title a.a -*^- \ + 2 -*^- track a.a.2 -*^- artist a.a.2.1; artist a.a.2.2 -*^- MP3 -*^- 320", + ), + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 1998 -*^- 00 -*^- 00 -*^- album_title a.a -*^- \ + 3 -*^- track a.a.3 -*^- artist a.a.3 -*^- FLAC -*^- 1061", + ), + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 1998 -*^- 00 -*^- 00 -*^- album_title a.a -*^- \ + 4 -*^- track a.a.4 -*^- artist a.a.4 -*^- FLAC -*^- 1042", + ), + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 2015 -*^- 04 -*^- 00 -*^- album_title a.b -*^- \ + 1 -*^- track a.b.1 -*^- artist a.b.1 -*^- FLAC -*^- 1004", + ), + String::from( + "Album_Artist ‘A’ -*^- -*^- \ + 2015 -*^- 04 -*^- 00 -*^- album_title a.b -*^- \ + 2 -*^- track a.b.2 -*^- artist a.b.2 -*^- FLAC -*^- 1077", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2003 -*^- 06 -*^- 06 -*^- album_title b.a -*^- \ + 1 -*^- track b.a.1 -*^- artist b.a.1 -*^- MP3 -*^- 190", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2003 -*^- 06 -*^- 06 -*^- album_title b.a -*^- \ + 2 -*^- track b.a.2 -*^- artist b.a.2.1; artist b.a.2.2 -*^- MP3 -*^- 120", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2008 -*^- 00 -*^- 00 -*^- album_title b.b -*^- \ + 1 -*^- track b.b.1 -*^- artist b.b.1 -*^- FLAC -*^- 1077", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2008 -*^- 00 -*^- 00 -*^- album_title b.b -*^- \ + 2 -*^- track b.b.2 -*^- artist b.b.2.1; artist b.b.2.2 -*^- MP3 -*^- 320", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2009 -*^- 00 -*^- 00 -*^- album_title b.c -*^- \ + 1 -*^- track b.c.1 -*^- artist b.c.1 -*^- MP3 -*^- 190", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2009 -*^- 00 -*^- 00 -*^- album_title b.c -*^- \ + 2 -*^- track b.c.2 -*^- artist b.c.2.1; artist b.c.2.2 -*^- MP3 -*^- 120", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2015 -*^- 00 -*^- 00 -*^- album_title b.d -*^- \ + 1 -*^- track b.d.1 -*^- artist b.d.1 -*^- MP3 -*^- 190", + ), + String::from( + "Album_Artist ‘B’ -*^- -*^- \ + 2015 -*^- 00 -*^- 00 -*^- album_title b.d -*^- \ + 2 -*^- track b.d.2 -*^- artist b.d.2.1; artist b.d.2.2 -*^- MP3 -*^- 120", + ), + String::from( + "The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- \ + 1985 -*^- 00 -*^- 00 -*^- album_title c.a -*^- \ + 1 -*^- track c.a.1 -*^- artist c.a.1 -*^- MP3 -*^- 320", + ), + String::from( + "The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- \ + 1985 -*^- 00 -*^- 00 -*^- album_title c.a -*^- \ + 2 -*^- track c.a.2 -*^- artist c.a.2.1; artist c.a.2.2 -*^- MP3 -*^- 120", + ), + String::from( + "The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- \ + 2018 -*^- 00 -*^- 00 -*^- album_title c.b -*^- \ + 1 -*^- track c.b.1 -*^- artist c.b.1 -*^- FLAC -*^- 1041", + ), + String::from( + "The Album_Artist ‘C’ -*^- Album_Artist ‘C’, The -*^- \ + 2018 -*^- 00 -*^- 00 -*^- album_title c.b -*^- \ + 2 -*^- track c.b.2 -*^- artist c.b.2.1; artist c.b.2.2 -*^- FLAC -*^- 756", + ), + String::from( + "Album_Artist ‘D’ -*^- -*^- \ + 1995 -*^- 00 -*^- 00 -*^- album_title d.a -*^- \ + 1 -*^- track d.a.1 -*^- artist d.a.1 -*^- MP3 -*^- 120", + ), + String::from( + "Album_Artist ‘D’ -*^- -*^- \ + 1995 -*^- 00 -*^- 00 -*^- album_title d.a -*^- \ + 2 -*^- track d.a.2 -*^- artist d.a.2.1; artist d.a.2.2 -*^- MP3 -*^- 120", + ), + String::from( + "Album_Artist ‘D’ -*^- -*^- \ + 2028 -*^- 00 -*^- 00 -*^- album_title d.b -*^- \ + 1 -*^- track d.b.1 -*^- artist d.b.1 -*^- FLAC -*^- 841", + ), + String::from( + "Album_Artist ‘D’ -*^- -*^- \ + 2028 -*^- 00 -*^- 00 -*^- album_title d.b -*^- \ + 2 -*^- track d.b.2 -*^- artist d.b.2.1; artist d.b.2.2 -*^- FLAC -*^- 756", + ), ] }); diff --git a/src/core/library/mod.rs b/src/core/library/mod.rs index 6e0778a..7797c07 100644 --- a/src/core/library/mod.rs +++ b/src/core/library/mod.rs @@ -8,7 +8,7 @@ use std::{collections::HashSet, fmt, num::ParseIntError, str::Utf8Error}; #[cfg(test)] use mockall::automock; -use crate::core::collection::track::Format; +use crate::core::collection::{album::AlbumMonth, track::TrackFormat}; /// Trait for interacting with the music library. #[cfg_attr(test, automock)] @@ -32,11 +32,13 @@ pub struct Item { pub album_artist: String, pub album_artist_sort: Option, pub album_year: u32, + pub album_month: AlbumMonth, + pub album_day: u8, pub album_title: String, pub track_number: u32, pub track_title: String, pub track_artist: Vec, - pub track_format: Format, + pub track_format: TrackFormat, pub track_bitrate: u32, } @@ -46,10 +48,13 @@ pub enum Field { AlbumArtist(String), AlbumArtistSort(String), AlbumYear(u32), + AlbumMonth(AlbumMonth), + AlbumDay(u8), AlbumTitle(String), TrackNumber(u32), TrackTitle(String), TrackArtist(Vec), + TrackFormat(TrackFormat), All(String), } diff --git a/src/core/library/testmod.rs b/src/core/library/testmod.rs index af2ed68..09e56b8 100644 --- a/src/core/library/testmod.rs +++ b/src/core/library/testmod.rs @@ -1,6 +1,9 @@ use once_cell::sync::Lazy; -use crate::core::{collection::track::Format, library::Item}; +use crate::core::{ + collection::{album::AlbumMonth, track::TrackFormat}, + library::Item, +}; pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { vec![ @@ -8,17 +11,21 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 1998, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title a.a"), track_number: 1, track_title: String::from("track a.a.1"), track_artist: vec![String::from("artist a.a.1")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 992, }, Item { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 1998, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title a.a"), track_number: 2, track_title: String::from("track a.a.2"), @@ -26,68 +33,80 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist a.a.2.1"), String::from("artist a.a.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 320, }, Item { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 1998, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title a.a"), track_number: 3, track_title: String::from("track a.a.3"), track_artist: vec![String::from("artist a.a.3")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1061, }, Item { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 1998, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title a.a"), track_number: 4, track_title: String::from("track a.a.4"), track_artist: vec![String::from("artist a.a.4")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1042, }, Item { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 2015, + album_month: AlbumMonth::April, + album_day: 0, album_title: String::from("album_title a.b"), track_number: 1, track_title: String::from("track a.b.1"), track_artist: vec![String::from("artist a.b.1")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1004, }, Item { album_artist: String::from("Album_Artist ‘A’"), album_artist_sort: None, album_year: 2015, + album_month: AlbumMonth::April, + album_day: 0, album_title: String::from("album_title a.b"), track_number: 2, track_title: String::from("track a.b.2"), track_artist: vec![String::from("artist a.b.2")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1077, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2003, + album_month: AlbumMonth::June, + album_day: 6, album_title: String::from("album_title b.a"), track_number: 1, track_title: String::from("track b.a.1"), track_artist: vec![String::from("artist b.a.1")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 190, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2003, + album_month: AlbumMonth::June, + album_day: 6, album_title: String::from("album_title b.a"), track_number: 2, track_title: String::from("track b.a.2"), @@ -95,24 +114,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist b.a.2.1"), String::from("artist b.a.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.b"), track_number: 1, track_title: String::from("track b.b.1"), track_artist: vec![String::from("artist b.b.1")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1077, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.b"), track_number: 2, track_title: String::from("track b.b.2"), @@ -120,24 +143,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist b.b.2.1"), String::from("artist b.b.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 320, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2009, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.c"), track_number: 1, track_title: String::from("track b.c.1"), track_artist: vec![String::from("artist b.c.1")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 190, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2009, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.c"), track_number: 2, track_title: String::from("track b.c.2"), @@ -145,24 +172,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist b.c.2.1"), String::from("artist b.c.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2015, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.d"), track_number: 1, track_title: String::from("track b.d.1"), track_artist: vec![String::from("artist b.d.1")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 190, }, Item { album_artist: String::from("Album_Artist ‘B’"), album_artist_sort: None, album_year: 2015, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title b.d"), track_number: 2, track_title: String::from("track b.d.2"), @@ -170,24 +201,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist b.d.2.1"), String::from("artist b.d.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("The Album_Artist ‘C’"), album_artist_sort: Some(String::from("Album_Artist ‘C’, The")), album_year: 1985, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title c.a"), track_number: 1, track_title: String::from("track c.a.1"), track_artist: vec![String::from("artist c.a.1")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 320, }, Item { album_artist: String::from("The Album_Artist ‘C’"), album_artist_sort: Some(String::from("Album_Artist ‘C’, The")), album_year: 1985, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title c.a"), track_number: 2, track_title: String::from("track c.a.2"), @@ -195,24 +230,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist c.a.2.1"), String::from("artist c.a.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("The Album_Artist ‘C’"), album_artist_sort: Some(String::from("Album_Artist ‘C’, The")), album_year: 2018, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title c.b"), track_number: 1, track_title: String::from("track c.b.1"), track_artist: vec![String::from("artist c.b.1")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1041, }, Item { album_artist: String::from("The Album_Artist ‘C’"), album_artist_sort: Some(String::from("Album_Artist ‘C’, The")), album_year: 2018, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title c.b"), track_number: 2, track_title: String::from("track c.b.2"), @@ -220,24 +259,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist c.b.2.1"), String::from("artist c.b.2.2"), ], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 756, }, Item { album_artist: String::from("Album_Artist ‘D’"), album_artist_sort: None, album_year: 1995, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title d.a"), track_number: 1, track_title: String::from("track d.a.1"), track_artist: vec![String::from("artist d.a.1")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("Album_Artist ‘D’"), album_artist_sort: None, album_year: 1995, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title d.a"), track_number: 2, track_title: String::from("track d.a.2"), @@ -245,24 +288,28 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist d.a.2.1"), String::from("artist d.a.2.2"), ], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 120, }, Item { album_artist: String::from("Album_Artist ‘D’"), album_artist_sort: None, album_year: 2028, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title d.b"), track_number: 1, track_title: String::from("track d.b.1"), track_artist: vec![String::from("artist d.b.1")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 841, }, Item { album_artist: String::from("Album_Artist ‘D’"), album_artist_sort: None, album_year: 2028, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("album_title d.b"), track_number: 2, track_title: String::from("track d.b.2"), @@ -270,7 +317,7 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { String::from("artist d.b.2.1"), String::from("artist d.b.2.2"), ], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 756, }, ] diff --git a/src/core/musichoard/musichoard.rs b/src/core/musichoard/musichoard.rs index 266502a..2cd0ad5 100644 --- a/src/core/musichoard/musichoard.rs +++ b/src/core/musichoard/musichoard.rs @@ -2,9 +2,9 @@ use std::collections::HashMap; use crate::core::{ collection::{ - album::{Album, AlbumId}, + album::{Album, AlbumDate, AlbumId}, artist::{Artist, ArtistId}, - track::{Quality, Track, TrackId}, + track::{Track, TrackId, TrackQuality}, Collection, Merge, }, database::IDatabase, @@ -99,7 +99,11 @@ impl MusicHoard { let artist_sort = item.album_artist_sort.map(|s| ArtistId { name: s }); let album_id = AlbumId { - year: item.album_year, + date: AlbumDate { + year: item.album_year, + month: item.album_month, + day: item.album_day, + }, title: item.album_title, }; @@ -109,7 +113,7 @@ impl MusicHoard { title: item.track_title, }, artist: item.track_artist, - quality: Quality { + quality: TrackQuality { format: item.track_format, bitrate: item.track_bitrate, }, @@ -887,7 +891,7 @@ mod tests { } #[test] - fn rescan_library_album_title_year_clash() { + fn rescan_library_album_title_date_clash() { let mut library = MockILibrary::new(); let mut expected = LIBRARY_COLLECTION.to_owned(); @@ -896,9 +900,14 @@ mod tests { let mut items = LIBRARY_ITEMS.to_owned(); for item in items.iter_mut().filter(|it| { - (it.album_year == removed_album_id.year) && (it.album_title == removed_album_id.title) + (it.album_year == removed_album_id.date.year) + && (it.album_month == removed_album_id.date.month) + && (it.album_day == removed_album_id.date.day) + && (it.album_title == removed_album_id.title) }) { - item.album_year = clashed_album_id.year; + 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(); } diff --git a/src/core/testmod.rs b/src/core/testmod.rs index 2f10f36..971587b 100644 --- a/src/core/testmod.rs +++ b/src/core/testmod.rs @@ -2,9 +2,9 @@ use once_cell::sync::Lazy; use std::collections::HashMap; use crate::core::collection::{ - album::{Album, AlbumId}, + album::{Album, AlbumDate, AlbumId, AlbumMonth}, artist::{Artist, ArtistId, MusicBrainz}, - track::{Format, Quality, Track, TrackId}, + track::{Track, TrackFormat, TrackId, TrackQuality}, }; use crate::tests::*; diff --git a/src/tests.rs b/src/tests.rs index bbb4de1..058c808 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -11,7 +11,11 @@ macro_rules! library_collection { albums: vec![ Album { id: AlbumId { - year: 1998, + date: AlbumDate { + year: 1998, + month: AlbumMonth::None, + day: 0, + }, title: "album_title a.a".to_string(), }, tracks: vec![ @@ -21,8 +25,8 @@ macro_rules! library_collection { title: "track a.a.1".to_string(), }, artist: vec!["artist a.a.1".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 992, }, }, @@ -35,8 +39,8 @@ macro_rules! library_collection { "artist a.a.2.1".to_string(), "artist a.a.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 320, }, }, @@ -46,8 +50,8 @@ macro_rules! library_collection { title: "track a.a.3".to_string(), }, artist: vec!["artist a.a.3".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1061, }, }, @@ -57,8 +61,8 @@ macro_rules! library_collection { title: "track a.a.4".to_string(), }, artist: vec!["artist a.a.4".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1042, }, }, @@ -66,7 +70,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2015, + date: AlbumDate { + year: 2015, + month: AlbumMonth::April, + day: 0, + }, title: "album_title a.b".to_string(), }, tracks: vec![ @@ -76,8 +84,8 @@ macro_rules! library_collection { title: "track a.b.1".to_string(), }, artist: vec!["artist a.b.1".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1004, }, }, @@ -87,8 +95,8 @@ macro_rules! library_collection { title: "track a.b.2".to_string(), }, artist: vec!["artist a.b.2".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1077, }, }, @@ -106,7 +114,11 @@ macro_rules! library_collection { albums: vec![ Album { id: AlbumId { - year: 2003, + date: AlbumDate { + year: 2003, + month: AlbumMonth::June, + day: 6, + }, title: "album_title b.a".to_string(), }, tracks: vec![ @@ -116,8 +128,8 @@ macro_rules! library_collection { title: "track b.a.1".to_string(), }, artist: vec!["artist b.a.1".to_string()], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 190, }, }, @@ -130,8 +142,8 @@ macro_rules! library_collection { "artist b.a.2.1".to_string(), "artist b.a.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -139,7 +151,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2008, + date: AlbumDate { + year: 2008, + month: AlbumMonth::None, + day: 0, + }, title: "album_title b.b".to_string(), }, tracks: vec![ @@ -149,8 +165,8 @@ macro_rules! library_collection { title: "track b.b.1".to_string(), }, artist: vec!["artist b.b.1".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1077, }, }, @@ -163,8 +179,8 @@ macro_rules! library_collection { "artist b.b.2.1".to_string(), "artist b.b.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 320, }, }, @@ -172,7 +188,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2009, + date: AlbumDate { + year: 2009, + month: AlbumMonth::None, + day: 0, + }, title: "album_title b.c".to_string(), }, tracks: vec![ @@ -182,8 +202,8 @@ macro_rules! library_collection { title: "track b.c.1".to_string(), }, artist: vec!["artist b.c.1".to_string()], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 190, }, }, @@ -196,8 +216,8 @@ macro_rules! library_collection { "artist b.c.2.1".to_string(), "artist b.c.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -205,7 +225,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2015, + date: AlbumDate { + year: 2015, + month: AlbumMonth::None, + day: 0, + }, title: "album_title b.d".to_string(), }, tracks: vec![ @@ -215,8 +239,8 @@ macro_rules! library_collection { title: "track b.d.1".to_string(), }, artist: vec!["artist b.d.1".to_string()], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 190, }, }, @@ -229,8 +253,8 @@ macro_rules! library_collection { "artist b.d.2.1".to_string(), "artist b.d.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -250,7 +274,11 @@ macro_rules! library_collection { albums: vec![ Album { id: AlbumId { - year: 1985, + date: AlbumDate { + year: 1985, + month: AlbumMonth::None, + day: 0, + }, title: "album_title c.a".to_string(), }, tracks: vec![ @@ -260,8 +288,8 @@ macro_rules! library_collection { title: "track c.a.1".to_string(), }, artist: vec!["artist c.a.1".to_string()], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 320, }, }, @@ -274,8 +302,8 @@ macro_rules! library_collection { "artist c.a.2.1".to_string(), "artist c.a.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -283,7 +311,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2018, + date: AlbumDate { + year: 2018, + month: AlbumMonth::None, + day: 0, + }, title: "album_title c.b".to_string(), }, tracks: vec![ @@ -293,8 +325,8 @@ macro_rules! library_collection { title: "track c.b.1".to_string(), }, artist: vec!["artist c.b.1".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1041, }, }, @@ -307,8 +339,8 @@ macro_rules! library_collection { "artist c.b.2.1".to_string(), "artist c.b.2.2".to_string(), ], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 756, }, }, @@ -326,7 +358,11 @@ macro_rules! library_collection { albums: vec![ Album { id: AlbumId { - year: 1995, + date: AlbumDate { + year: 1995, + month: AlbumMonth::None, + day: 0, + }, title: "album_title d.a".to_string(), }, tracks: vec![ @@ -336,8 +372,8 @@ macro_rules! library_collection { title: "track d.a.1".to_string(), }, artist: vec!["artist d.a.1".to_string()], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -350,8 +386,8 @@ macro_rules! library_collection { "artist d.a.2.1".to_string(), "artist d.a.2.2".to_string(), ], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 120, }, }, @@ -359,7 +395,11 @@ macro_rules! library_collection { }, Album { id: AlbumId { - year: 2028, + date: AlbumDate { + year: 2028, + month: AlbumMonth::None, + day: 0, + }, title: "album_title d.b".to_string(), }, tracks: vec![ @@ -369,8 +409,8 @@ macro_rules! library_collection { title: "track d.b.1".to_string(), }, artist: vec!["artist d.b.1".to_string()], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 841, }, }, @@ -383,8 +423,8 @@ macro_rules! library_collection { "artist d.b.2.1".to_string(), "artist d.b.2.2".to_string(), ], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 756, }, }, diff --git a/src/tui/testmod.rs b/src/tui/testmod.rs index 7054f71..7a3bc37 100644 --- a/src/tui/testmod.rs +++ b/src/tui/testmod.rs @@ -1,7 +1,7 @@ use musichoard::collection::{ - album::{Album, AlbumId}, + album::{Album, AlbumDate, AlbumId, AlbumMonth}, artist::{Artist, ArtistId, MusicBrainz}, - track::{Format, Quality, Track, TrackId}, + track::{Track, TrackFormat, TrackId, TrackQuality}, }; use once_cell::sync::Lazy; use std::collections::HashMap; diff --git a/src/tui/ui.rs b/src/tui/ui.rs index 5f6b467..3a151b8 100644 --- a/src/tui/ui.rs +++ b/src/tui/ui.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use musichoard::collection::{ album::Album, artist::Artist, - track::{Format, Track}, + track::{Track, TrackFormat}, Collection, }; use ratatui::{ @@ -289,7 +289,9 @@ impl<'a, 'b> AlbumState<'a, 'b> { "Title: {}\n\ Year: {}", album.map(|a| a.id.title.as_str()).unwrap_or(""), - album.map(|a| a.id.year.to_string()).unwrap_or_default(), + album + .map(|a| a.id.date.year.to_string()) + .unwrap_or_default(), )); AlbumState { @@ -328,8 +330,8 @@ impl<'a, 'b> TrackState<'a, 'b> { track.map(|t| t.artist.join("; ")).unwrap_or_default(), track .map(|t| match t.quality.format { - Format::Flac => "FLAC".to_string(), - Format::Mp3 => format!("MP3 {}kbps", t.quality.bitrate), + TrackFormat::Flac => "FLAC".to_string(), + TrackFormat::Mp3 => format!("MP3 {}kbps", t.quality.bitrate), }) .unwrap_or_default(), )); diff --git a/tests/library/testmod.rs b/tests/library/testmod.rs index bfd1658..cb85c50 100644 --- a/tests/library/testmod.rs +++ b/tests/library/testmod.rs @@ -1,6 +1,9 @@ use once_cell::sync::Lazy; -use musichoard::{collection::track::Format, library::Item}; +use musichoard::{ + collection::{album::AlbumMonth, track::TrackFormat}, + library::Item, +}; pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { vec![ @@ -8,880 +11,1040 @@ pub static LIBRARY_ITEMS: Lazy> = Lazy::new(|| -> Vec { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 1, track_title: String::from("Az’"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 992, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 2, track_title: String::from("Arkaim"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1061, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 3, track_title: String::from("Bol’no mne"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1004, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 4, track_title: String::from("Leshiy"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1077, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 5, track_title: String::from("Zakliatie"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1041, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 6, track_title: String::from("Predok"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 756, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 7, track_title: String::from("Nikogda"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1059, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 8, track_title: String::from("Tam za tumanami"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1023, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 9, track_title: String::from("Potomok"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 838, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 10, track_title: String::from("Slovo"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1028, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 11, track_title: String::from("Odna"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 991, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 12, track_title: String::from("Vo moiom sadochke…"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 919, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 13, track_title: String::from("Stenka na stenku"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1039, }, Item { album_artist: String::from("Аркона"), album_artist_sort: Some(String::from("Arkona")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slovo"), track_number: 14, track_title: String::from("Zimushka"), track_artist: vec![String::from("Аркона")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 974, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 1, track_title: String::from("Verja Urit an Bitus"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 961, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 2, track_title: String::from("Uis Elveti"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1067, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 3, track_title: String::from("Ôrô"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 933, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 4, track_title: String::from("Lament"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1083, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 5, track_title: String::from("Druid"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1073, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2004, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Vên [re‐recorded]"), track_number: 6, track_title: String::from("Jêzaïg"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1002, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 1, track_title: String::from("Samon"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 953, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 2, track_title: String::from("Primordial Breath"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1103, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 3, track_title: String::from("Inis Mona"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1117, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 4, track_title: String::from("Gray Sublime Archon"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1092, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 5, track_title: String::from("Anagantios"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 923, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 6, track_title: String::from("Bloodstained Ground"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1098, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 7, track_title: String::from("The Somber Lay"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1068, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 8, track_title: String::from("Slanias Song"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1098, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 9, track_title: String::from("Giamonios"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 825, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 10, track_title: String::from("Tarvos"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1115, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 11, track_title: String::from("Calling the Rain"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1096, }, Item { album_artist: String::from("Eluveitie"), album_artist_sort: None, album_year: 2008, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Slania"), track_number: 12, track_title: String::from("Elembivos"), track_artist: vec![String::from("Eluveitie")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1059, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 1, track_title: String::from("Intro = Chaos"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1024, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 2, track_title: String::from("Modlitwa"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1073, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 3, track_title: String::from("Długa droga z piekła"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1058, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 4, track_title: String::from("Synowie ognia"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1066, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 5, track_title: String::from("1902"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1074, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 6, track_title: String::from("Krew za krew"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1080, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 7, track_title: String::from("Kulminacja"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 992, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 8, track_title: String::from("Judasz"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1018, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 9, track_title: String::from("Więzy"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1077, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 10, track_title: String::from("Zagubione dusze"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1033, }, Item { album_artist: String::from("Frontside"), album_artist_sort: None, album_year: 2001, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), track_number: 11, track_title: String::from("Linia życia"), track_artist: vec![String::from("Frontside")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 987, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: None, album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Paper Plague"), track_number: 0, track_title: String::from("Paper Plague"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 320, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 1, track_title: String::from("Unbreakable"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 208, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 2, track_title: String::from("Guilt Trips and Sins"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 205, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 3, track_title: String::from("The Long Goodbye"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 227, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 4, track_title: String::from("Close Encounters"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 213, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 5, track_title: String::from("Paranoia"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 218, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 6, track_title: String::from("Let Me Out of Here"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 207, }, Item { album_artist: String::from("Heaven’s Basement"), album_artist_sort: Some(String::from("Heaven’s Basement")), album_year: 2011, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Unbreakable"), track_number: 7, track_title: String::from("Leeches"), track_artist: vec![String::from("Heaven’s Basement")], - track_format: Format::Mp3, + track_format: TrackFormat::Mp3, track_bitrate: 225, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 1, track_title: String::from("Fight Fire with Fire"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 954, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 2, track_title: String::from("Ride the Lightning"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 951, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 3, track_title: String::from("For Whom the Bell Tolls"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 889, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 4, track_title: String::from("Fade to Black"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 939, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 5, track_title: String::from("Trapped under Ice"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 955, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 6, track_title: String::from("Escape"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 941, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 7, track_title: String::from("Creeping Death"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 958, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1984, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("Ride the Lightning"), track_number: 8, track_title: String::from("The Call of Ktulu"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 888, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 1, track_title: String::from("The Ecstasy of Gold"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 875, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 2, track_title: String::from("The Call of Ktulu"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1030, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 3, track_title: String::from("Master of Puppets"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1082, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 4, track_title: String::from("Of Wolf and Man"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1115, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 5, track_title: String::from("The Thing That Should Not Be"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1029, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 6, track_title: String::from("Fuel"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1057, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 7, track_title: String::from("The Memory Remains"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1080, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 8, track_title: String::from("No Leaf Clover"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1004, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 9, track_title: String::from("Hero of the Day"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 962, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 10, track_title: String::from("Devil’s Dance"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1076, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 11, track_title: String::from("Bleeding Me"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 993, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 12, track_title: String::from("Nothing Else Matters"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 875, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 13, track_title: String::from("Until It Sleeps"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1038, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 14, track_title: String::from("For Whom the Bell Tolls"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1072, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 15, track_title: String::from("−Human"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1029, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 16, track_title: String::from("Wherever I May Roam"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1035, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 17, track_title: String::from("Outlaw Torn"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1042, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 18, track_title: String::from("Sad but True"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1082, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 19, track_title: String::from("One"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 1017, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 20, track_title: String::from("Enter Sandman"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 993, }, Item { album_artist: String::from("Metallica"), album_artist_sort: None, album_year: 1999, + album_month: AlbumMonth::None, + album_day: 0, album_title: String::from("S&M"), track_number: 21, track_title: String::from("Battery"), track_artist: vec![String::from("Metallica")], - track_format: Format::Flac, + track_format: TrackFormat::Flac, track_bitrate: 967, }, ] diff --git a/tests/testlib.rs b/tests/testlib.rs index ef4821e..3cf1b98 100644 --- a/tests/testlib.rs +++ b/tests/testlib.rs @@ -2,9 +2,9 @@ use once_cell::sync::Lazy; use std::collections::HashMap; use musichoard::collection::{ - album::{Album, AlbumId}, + album::{Album, AlbumDate, AlbumId, AlbumMonth}, artist::{Artist, ArtistId, MusicBrainz}, - track::{Format, Quality, Track, TrackId}, + track::{Track, TrackFormat, TrackId, TrackQuality}, Collection, }; @@ -33,7 +33,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { ]), albums: vec![Album { id: AlbumId { - year: 2011, + date: AlbumDate{ + year: 2011, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Slovo"), }, tracks: vec![ @@ -43,8 +47,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Az’"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 992, }, }, @@ -54,8 +58,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Arkaim"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1061, }, }, @@ -65,8 +69,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Bol’no mne"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1004, }, }, @@ -76,8 +80,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Leshiy"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1077, }, }, @@ -87,8 +91,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Zakliatie"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1041, }, }, @@ -98,8 +102,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Predok"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 756, }, }, @@ -109,8 +113,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Nikogda"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1059, }, }, @@ -120,8 +124,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Tam za tumanami"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1023, }, }, @@ -131,8 +135,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Potomok"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 838, }, }, @@ -142,8 +146,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Slovo"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1028, }, }, @@ -153,8 +157,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Odna"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 991, }, }, @@ -164,8 +168,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Vo moiom sadochke…"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 919, }, }, @@ -175,8 +179,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Stenka na stenku"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1039, }, }, @@ -186,8 +190,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Zimushka"), }, artist: vec![String::from("Аркона")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 974, }, }, @@ -213,7 +217,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { albums: vec![ Album { id: AlbumId { - year: 2004, + date: AlbumDate{ + year: 2004, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Vên [re‐recorded]"), }, tracks: vec![ @@ -223,8 +231,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Verja Urit an Bitus"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 961, }, }, @@ -234,8 +242,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Uis Elveti"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1067, }, }, @@ -245,8 +253,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Ôrô"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 933, }, }, @@ -256,8 +264,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Lament"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1083, }, }, @@ -267,8 +275,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Druid"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1073, }, }, @@ -278,8 +286,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Jêzaïg"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1002, }, }, @@ -287,7 +295,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { }, Album { id: AlbumId { - year: 2008, + date: AlbumDate{ + year: 2008, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Slania"), }, tracks: vec![ @@ -297,8 +309,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Samon"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 953, }, }, @@ -308,8 +320,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Primordial Breath"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1103, }, }, @@ -319,8 +331,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Inis Mona"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1117, }, }, @@ -330,8 +342,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Gray Sublime Archon"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1092, }, }, @@ -341,8 +353,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Anagantios"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 923, }, }, @@ -352,8 +364,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Bloodstained Ground"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1098, }, }, @@ -363,8 +375,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Somber Lay"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1068, }, }, @@ -374,8 +386,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Slanias Song"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1098, }, }, @@ -385,8 +397,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Giamonios"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 825, }, }, @@ -396,8 +408,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Tarvos"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1115, }, }, @@ -407,8 +419,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Calling the Rain"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1096, }, }, @@ -418,8 +430,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Elembivos"), }, artist: vec![String::from("Eluveitie")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1059, }, }, @@ -445,7 +457,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { ]), albums: vec![Album { id: AlbumId { - year: 2001, + date: AlbumDate{ + year: 2001, + month: AlbumMonth::None, + day: 0, + }, title: String::from("…nasze jest królestwo, potęga i chwała na wieki…"), }, tracks: vec![ @@ -455,8 +471,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Intro = Chaos"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1024, }, }, @@ -466,8 +482,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Modlitwa"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1073, }, }, @@ -477,8 +493,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Długa droga z piekła"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1058, }, }, @@ -488,8 +504,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Synowie ognia"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1066, }, }, @@ -499,8 +515,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("1902"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1074, }, }, @@ -510,8 +526,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Krew za krew"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1080, }, }, @@ -521,8 +537,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Kulminacja"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 992, }, }, @@ -532,8 +548,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Judasz"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1018, }, }, @@ -543,8 +559,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Więzy"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1077, }, }, @@ -554,8 +570,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Zagubione dusze"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1033, }, }, @@ -565,8 +581,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Linia życia"), }, artist: vec![String::from("Frontside")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 987, }, }, @@ -593,7 +609,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { ]), albums: vec![Album { id: AlbumId { - year: 2011, + date: AlbumDate{ + year: 2011, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Paper Plague"), }, tracks: vec![ @@ -603,15 +623,19 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Paper Plague"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 320, }, }, ], }, Album { id: AlbumId { - year: 2011, + date: AlbumDate{ + year: 2011, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Unbreakable"), }, tracks: vec![ @@ -621,8 +645,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Unbreakable"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 208, }, }, @@ -632,8 +656,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Guilt Trips and Sins"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 205, }, }, @@ -643,8 +667,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Long Goodbye"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 227, }, }, @@ -654,8 +678,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Close Encounters"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 213, }, }, @@ -665,8 +689,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Paranoia"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 218, }, }, @@ -676,8 +700,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Let Me Out of Here"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 207, }, }, @@ -687,8 +711,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Leeches"), }, artist: vec![String::from("Heaven’s Basement")], - quality: Quality { - format: Format::Mp3, + quality: TrackQuality { + format: TrackFormat::Mp3, bitrate: 225, }, }, @@ -714,7 +738,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { albums: vec![ Album { id: AlbumId { - year: 1984, + date: AlbumDate{ + year: 1984, + month: AlbumMonth::None, + day: 0, + }, title: String::from("Ride the Lightning"), }, tracks: vec![ @@ -724,8 +752,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Fight Fire with Fire"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 954, }, }, @@ -735,8 +763,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Ride the Lightning"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 951, }, }, @@ -746,8 +774,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("For Whom the Bell Tolls"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 889, }, }, @@ -757,8 +785,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Fade to Black"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 939, }, }, @@ -768,8 +796,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Trapped under Ice"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 955, }, }, @@ -779,8 +807,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Escape"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 941, }, }, @@ -790,8 +818,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Creeping Death"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 958, }, }, @@ -801,8 +829,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Call of Ktulu"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 888, }, }, @@ -810,7 +838,11 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { }, Album { id: AlbumId { - year: 1999, + date: AlbumDate{ + year: 1999, + month: AlbumMonth::None, + day: 0, + }, title: String::from("S&M"), }, tracks: vec![ @@ -820,8 +852,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Ecstasy of Gold"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 875, }, }, @@ -831,8 +863,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Call of Ktulu"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1030, }, }, @@ -842,8 +874,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Master of Puppets"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1082, }, }, @@ -853,8 +885,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Of Wolf and Man"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1115, }, }, @@ -864,8 +896,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Thing That Should Not Be"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1029, }, }, @@ -875,8 +907,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Fuel"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1057, }, }, @@ -886,8 +918,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("The Memory Remains"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1080, }, }, @@ -897,8 +929,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("No Leaf Clover"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1004, }, }, @@ -908,8 +940,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Hero of the Day"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 962, }, }, @@ -919,8 +951,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Devil’s Dance"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1076, }, }, @@ -930,8 +962,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Bleeding Me"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 993, }, }, @@ -941,8 +973,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Nothing Else Matters"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 875, }, }, @@ -952,8 +984,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Until It Sleeps"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1038, }, }, @@ -963,8 +995,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("For Whom the Bell Tolls"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1072, }, }, @@ -974,8 +1006,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("−Human"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1029, }, }, @@ -985,8 +1017,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Wherever I May Roam"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1035, }, }, @@ -996,8 +1028,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Outlaw Torn"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1042, }, }, @@ -1007,8 +1039,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Sad but True"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1082, }, }, @@ -1018,8 +1050,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("One"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 1017, }, }, @@ -1029,8 +1061,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Enter Sandman"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 993, }, }, @@ -1040,8 +1072,8 @@ pub static COLLECTION: Lazy> = Lazy::new(|| -> Collection { title: String::from("Battery"), }, artist: vec![String::from("Metallica")], - quality: Quality { - format: Format::Flac, + quality: TrackQuality { + format: TrackFormat::Flac, bitrate: 967, }, },