From e5231567cc17ef0655b9de963d262dd9d3fee374 Mon Sep 17 00:00:00 2001 From: Serial Date: Tue, 20 Apr 2021 11:25:09 -0400 Subject: [PATCH] Remove add_artist and add_album_artist These were useless methods that shouldn't be handled by lofty anyway --- src/components/tags/mp4_tag.rs | 16 ++++------------ src/traits.rs | 16 ---------------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/src/components/tags/mp4_tag.rs b/src/components/tags/mp4_tag.rs index 99509975..7656b430 100644 --- a/src/components/tags/mp4_tag.rs +++ b/src/components/tags/mp4_tag.rs @@ -67,8 +67,8 @@ impl<'a> From> for Mp4Tag { if let Some(v) = inp.title() { tag.set_title(v) } - if let Some(i) = inp.artists() { - i.iter().for_each(|&a| tag.add_artist(a)) + if let Some(i) = inp.artists_as_string() { + tag.set_artist(&*i) } if let Some(v) = inp.year { tag.set_year(v) @@ -76,8 +76,8 @@ impl<'a> From> for Mp4Tag { if let Some(v) = inp.album().title { tag.set_album_title(v) } - if let Some(i) = inp.album().artists { - i.iter().for_each(|&a| tag.add_album_artist(a)) + if let Some(i) = inp.album().artists_as_string() { + tag.set_album_artist(&*i) } if let Some(v) = inp.track_number() { tag.set_track_number(v) @@ -130,10 +130,6 @@ impl AudioTagEdit for Mp4Tag { self.0.set_artist(artist) } - fn add_artist(&mut self, artist: &str) { - self.0.add_artist(artist); - } - fn remove_artist(&mut self) { self.0.remove_artists(); } @@ -176,10 +172,6 @@ impl AudioTagEdit for Mp4Tag { self.0.set_album_artist(artists) } - fn add_album_artist(&mut self, artist: &str) { - self.0.add_album_artist(artist) - } - fn remove_album_artists(&mut self) { self.0.remove_data(&FourCC(*b"aART")); self.0.remove_album_artists(); diff --git a/src/traits.rs b/src/traits.rs index d5a7bb2d..d7ca346b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -15,14 +15,6 @@ pub trait AudioTagEdit { fn artist_str(&self) -> Option<&str>; fn set_artist(&mut self, artist: &str); - fn add_artist(&mut self, artist: &str) { - if let Some(mut artists) = self.artists_vec() { - artists.push(artist); - self.set_artist(&artists.join("/")) - } else { - self.set_artist(artist) - } - } fn artists_vec(&self) -> Option> { self.artist_str().map(|a| a.split('/').collect()) @@ -50,14 +42,6 @@ pub trait AudioTagEdit { self.album_artist_str().map(|a| a.split('/').collect()) } fn set_album_artist(&mut self, artist: &str); - fn add_album_artist(&mut self, artist: &str) { - if let Some(mut artists) = self.album_artists_vec() { - artists.push(artist); - self.set_album_artist(&artists.join("/")) - } else { - self.set_album_artist(artist) - } - } fn remove_album_artists(&mut self); fn album_cover(&self) -> Option;