mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 13:42:34 +00:00
Add encoder methods
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
72e361a097
commit
8eb8b12f32
6 changed files with 29 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue