Add encoder methods

Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
Serial 2021-07-10 12:31:56 -04:00
parent 72e361a097
commit 8eb8b12f32
6 changed files with 29 additions and 0 deletions

View file

@ -75,6 +75,7 @@ impl AudioTagEdit for ApeTag {
get_set_methods!(lyricist, "Lyricist");
get_set_methods!(composer, "Composer");
get_set_methods!(album_title, "Album");
get_set_methods!(encoder, "Encoder");
// Album artists aren't standard?
get_set_methods!(album_artist, "Album artist");

View file

@ -206,6 +206,20 @@ impl AudioTagEdit for Id3v2Tag {
self.inner.remove("TCOM")
}
fn encoder(&self) -> Option<&str> {
if let Some(frame) = self.inner.get("TSSE") {
return frame.content().text();
}
None
}
fn set_encoder(&mut self, encoder: &str) {
self.inner.set_text("TSSE", encoder)
}
fn remove_encoder(&mut self) {
self.inner.remove("TSSE")
}
fn album_title(&self) -> Option<&str> {
self.inner.album()
}

View file

@ -135,6 +135,16 @@ impl AudioTagEdit for Mp4Tag {
self.inner.remove_lyricists()
}
fn encoder(&self) -> Option<&str> {
self.inner.encoder()
}
fn set_encoder(&mut self, encoder: &str) {
self.inner.set_encoder(encoder)
}
fn remove_encoder(&mut self) {
self.inner.remove_encoder()
}
fn album_title(&self) -> Option<&str> {
self.inner.album()
}

View file

@ -192,6 +192,7 @@ impl AudioTagEdit for OggTag {
get_set_methods!(composer, "COMPOSER");
get_set_methods!(album_title, "ALBUM");
get_set_methods!(album_artist, "ALBUMARTIST");
get_set_methods!(encoder, "ENCODER");
fn date(&self) -> Option<String> {
self.get_value("DATE").map(std::string::ToString::to_string)

View file

@ -62,6 +62,7 @@ impl AudioTagEdit for RiffTag {
get_set_methods!(copyright, "ICOP");
get_set_methods!(genre, "IGNR");
get_set_methods!(album_title, "IPRD");
get_set_methods!(encoder, "ISFT");
fn date(&self) -> Option<String> {
self.get_value("ICRD").map(std::string::ToString::to_string)

View file

@ -42,6 +42,8 @@ pub trait AudioTagEdit {
str_accessor!(lyricist);
str_accessor!(composer);
str_accessor!(encoder);
/// Returns the track's [`Album`]
fn album(&self) -> Album<'_> {
Album {