diff --git a/lofty-attr/Cargo.toml b/lofty-attr/Cargo.toml index 847fe3b8..0d94ad11 100644 --- a/lofty-attr/Cargo.toml +++ b/lofty-attr/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lofty_attr" -version = "0.1.4" +version = "0.1.5" authors = ["Serial <69764315+Serial-ATA@users.noreply.github.com>"] description = "Macro for Lofty tag struct creation" license = "MIT OR Apache-2.0" diff --git a/lofty-attr/src/lib.rs b/lofty-attr/src/lib.rs index 78a84473..f23a4884 100644 --- a/lofty-attr/src/lib.rs +++ b/lofty-attr/src/lib.rs @@ -85,11 +85,11 @@ pub fn impl_tag(args: TokenStream, input: TokenStream) -> TokenStream { fn from(inp: &'a #input_ident) -> Self { Self { title: inp.title(), - artists: inp.artists_vec(), + artist: inp.artist_str(), year: inp.year().map(|y| y as i32), album: Album::new( inp.album_title(), - inp.album_artists_vec(), + inp.album_artist_str(), inp.album_covers(), ), track_number: inp.track_number(), @@ -109,18 +109,12 @@ pub fn impl_tag(args: TokenStream, input: TokenStream) -> TokenStream { if let Some(v) = inp.title() { tag.set_title(v) } - if let Some(v) = inp.artists_as_string() { + if let Some(v) = inp.artist() { tag.set_artist(&v) } if let Some(v) = inp.year { tag.set_year(v) } - if let Some(v) = inp.album().title { - tag.set_album_title(v) - } - if let Some(v) = inp.album().artists { - tag.set_album_artist(&v.join("/")) - } if let Some(v) = inp.track_number() { tag.set_track_number(v) } @@ -134,6 +128,21 @@ pub fn impl_tag(args: TokenStream, input: TokenStream) -> TokenStream { tag.set_total_discs(v) } + let album = inp.album(); + + if let Some(v) = album.title { + tag.set_album_title(v) + } + if let Some(v) = album.artist { + tag.set_album_artist(v) + } + if let Some(v) = album.covers.0 { + tag.set_front_cover(v) + } + if let Some(v) = album.covers.1 { + tag.set_back_cover(v) + } + tag } }