mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 14:44:22 +00:00
Revert changes made in lofty-attr
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
37fc8ef905
commit
579902ceb5
3 changed files with 37 additions and 47 deletions
2
lofty-attr/Cargo.lock
generated
2
lofty-attr/Cargo.lock
generated
|
@ -4,7 +4,7 @@ version = 3
|
|||
|
||||
[[package]]
|
||||
name = "lofty_attr"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"syn",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "lofty_attr"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
authors = ["Serial <69764315+Serial-ATA@users.noreply.github.com>"]
|
||||
description = "Macro for Lofty tag struct creation"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
|
|
@ -23,50 +23,6 @@ pub fn impl_tag(args: TokenStream, input: TokenStream) -> TokenStream {
|
|||
if let Some(inner) = inner.get_ident() {
|
||||
let input_ident = input.ident;
|
||||
|
||||
let mut anytag_convert = quote! {
|
||||
impl<'a> From<AnyTag<'a>> for #input_ident {
|
||||
fn from(inp: AnyTag<'a>) -> Self {
|
||||
let mut tag = #input_ident::default();
|
||||
|
||||
if let Some(v) = inp.title() {
|
||||
tag.set_title(v)
|
||||
}
|
||||
if let Some(v) = inp.artists_as_string() {
|
||||
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)
|
||||
}
|
||||
if let Some(v) = inp.total_tracks() {
|
||||
tag.set_total_tracks(v)
|
||||
}
|
||||
if let Some(v) = inp.disc_number() {
|
||||
tag.set_disc_number(v)
|
||||
}
|
||||
if let Some(v) = inp.total_discs() {
|
||||
tag.set_total_discs(v)
|
||||
}
|
||||
|
||||
tag
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(attr) = input.attrs.first() {
|
||||
if attr.path.is_ident("custom_convert") {
|
||||
anytag_convert = quote! {};
|
||||
}
|
||||
}
|
||||
|
||||
let expanded = quote! {
|
||||
#[doc(hidden)]
|
||||
pub struct #input_ident {
|
||||
|
@ -146,7 +102,41 @@ pub fn impl_tag(args: TokenStream, input: TokenStream) -> TokenStream {
|
|||
}
|
||||
}
|
||||
|
||||
#anytag_convert
|
||||
impl<'a> From<AnyTag<'a>> for #input_ident {
|
||||
fn from(inp: AnyTag<'a>) -> Self {
|
||||
let mut tag = #input_ident::default();
|
||||
|
||||
if let Some(v) = inp.title() {
|
||||
tag.set_title(v)
|
||||
}
|
||||
if let Some(v) = inp.artists_as_string() {
|
||||
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)
|
||||
}
|
||||
if let Some(v) = inp.total_tracks() {
|
||||
tag.set_total_tracks(v)
|
||||
}
|
||||
if let Some(v) = inp.disc_number() {
|
||||
tag.set_disc_number(v)
|
||||
}
|
||||
if let Some(v) = inp.total_discs() {
|
||||
tag.set_total_discs(v)
|
||||
}
|
||||
|
||||
tag
|
||||
}
|
||||
}
|
||||
|
||||
// From dyn AudioTag to wrapper (any type)
|
||||
impl From<Box<dyn AudioTag>> for #input_ident {
|
||||
|
|
Loading…
Reference in a new issue