mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-11-10 06:34:18 +00:00
simplify
This commit is contained in:
parent
7eb57f1874
commit
f233955413
2 changed files with 4 additions and 36 deletions
|
@ -8,26 +8,10 @@ impl<'a> From<AnyTag<'a>> for FlacTag {
|
||||||
fn from(inp: AnyTag<'a>) -> Self {
|
fn from(inp: AnyTag<'a>) -> Self {
|
||||||
let mut t = FlacTag::default();
|
let mut t = FlacTag::default();
|
||||||
inp.title().map(|v| t.set_title(v));
|
inp.title().map(|v| t.set_title(v));
|
||||||
inp.artists()
|
inp.artists_as_string().map(|v| t.set_artist(&v));
|
||||||
.map(|i| {
|
|
||||||
i.iter().fold(String::new(), |mut v, a| {
|
|
||||||
v.push_str(&a);
|
|
||||||
v.push_str(inp.config.sep_artist);
|
|
||||||
v
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.map(|v| t.set_artist(&v[..v.len() - 1]));
|
|
||||||
inp.year.map(|v| t.set_year(v));
|
inp.year.map(|v| t.set_year(v));
|
||||||
inp.album_title().map(|v| t.set_album_title(v));
|
inp.album_title().map(|v| t.set_album_title(v));
|
||||||
inp.album_artists()
|
inp.album_artists_as_string().map(|v| t.set_artist(&v));
|
||||||
.map(|i| {
|
|
||||||
i.iter().fold(String::new(), |mut v, a| {
|
|
||||||
v.push_str(&a);
|
|
||||||
v.push_str(inp.config.sep_artist);
|
|
||||||
v
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.map(|v| t.set_album_artist(&v[..v.len() - 1]));
|
|
||||||
inp.track_number().map(|v| t.set_track_number(v));
|
inp.track_number().map(|v| t.set_track_number(v));
|
||||||
inp.total_tracks().map(|v| t.set_total_tracks(v));
|
inp.total_tracks().map(|v| t.set_total_tracks(v));
|
||||||
inp.disc_number().map(|v| t.set_disc_number(v));
|
inp.disc_number().map(|v| t.set_disc_number(v));
|
||||||
|
|
|
@ -31,26 +31,10 @@ impl<'a> From<AnyTag<'a>> for Id3v2Tag {
|
||||||
inner: {
|
inner: {
|
||||||
let mut t = id3::Tag::new();
|
let mut t = id3::Tag::new();
|
||||||
inp.title().map(|v| t.set_title(v));
|
inp.title().map(|v| t.set_title(v));
|
||||||
inp.artists()
|
inp.artists_as_string().map(|v| t.set_artist(&v));
|
||||||
.map(|i| {
|
|
||||||
i.iter().fold(String::new(), |mut v, a| {
|
|
||||||
v.push_str(&a);
|
|
||||||
v.push_str(inp.config.sep_artist);
|
|
||||||
v
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.map(|v| t.set_artist(&v[..v.len() - 1]));
|
|
||||||
inp.year.map(|v| t.set_year(v));
|
inp.year.map(|v| t.set_year(v));
|
||||||
inp.album_title().map(|v| t.set_album(v));
|
inp.album_title().map(|v| t.set_album(v));
|
||||||
inp.album_artists()
|
inp.album_artists_as_string().map(|v| t.set_artist(&v));
|
||||||
.map(|i| {
|
|
||||||
i.iter().fold(String::new(), |mut v, a| {
|
|
||||||
v.push_str(&a);
|
|
||||||
v.push_str(inp.config.sep_artist);
|
|
||||||
v
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.map(|v| t.set_album_artist(&v[..v.len() - 1]));
|
|
||||||
inp.track_number().map(|v| t.set_track(v as u32));
|
inp.track_number().map(|v| t.set_track(v as u32));
|
||||||
inp.total_tracks().map(|v| t.set_total_tracks(v as u32));
|
inp.total_tracks().map(|v| t.set_total_tracks(v as u32));
|
||||||
inp.disc_number().map(|v| t.set_disc(v as u32));
|
inp.disc_number().map(|v| t.set_disc(v as u32));
|
||||||
|
|
Loading…
Reference in a new issue