mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 21:52:33 +00:00
Update lofty-attr
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
5754fd7c67
commit
e1101af9a7
2 changed files with 19 additions and 10 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue