mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2025-03-04 06:47:12 +00:00
prevent clone
This commit is contained in:
parent
f2c743d81e
commit
d4af2dcb03
6 changed files with 12 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "audiotags"
|
||||
version = "0.2.5"
|
||||
version = "0.2.6"
|
||||
authors = ["Tianyi <ShiTianyi2001@outlook.com>"]
|
||||
edition = "2018"
|
||||
description = "Unified IO for different types of audio metadata"
|
||||
|
@ -15,4 +15,4 @@ mp4ameta = "0.6"
|
|||
metaflac = "0.2"
|
||||
beef = "0.4.4"
|
||||
thiserror = "1.0.21"
|
||||
audiotags-dev-macro = "0.1.0"
|
||||
audiotags-dev-macro = {path = "./audiotags-dev-macro", version = "0.1.1"}
|
|
@ -100,9 +100,9 @@ fn main() {
|
|||
Some(vec!["artist1 of mp4", "artist2 of mp4"])
|
||||
);
|
||||
// convert to id3 tag, which does not support multiple artists
|
||||
let mp3tag = mp4tag
|
||||
.with_config(Config::default().sep_artist("/")) // separator is by default `;`
|
||||
.into_tag(TagType::Id3v2);
|
||||
mp4tag.set_config(Config::default().sep_artist("/"));
|
||||
// separator is by default `;` but we can customise it
|
||||
let mp3tag = mp4tag.into_tag(TagType::Id3v2);
|
||||
assert_eq!(mp3tag.artist(), Some("artist1 of mp4/artist2 of mp4"));
|
||||
}
|
||||
```
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "audiotags-dev-macro"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
authors = ["Tianyi <ShiTianyi2001@outlook.com>"]
|
||||
edition = "2018"
|
||||
description = "macros used during the development of audiotags"
|
||||
|
|
|
@ -21,11 +21,8 @@ macro_rules! impl_tag {
|
|||
fn config(&self) -> &Config {
|
||||
&self.config
|
||||
}
|
||||
fn with_config(&self, config: Config) -> Box<dyn AudioTag> {
|
||||
Box::new(Self {
|
||||
inner: self.inner.clone(),
|
||||
config,
|
||||
})
|
||||
fn set_config(&mut self, config: Config) {
|
||||
self.config = config.clone();
|
||||
}
|
||||
fn into_anytag(&self) -> AnyTag<'_> {
|
||||
self.into()
|
||||
|
|
|
@ -539,7 +539,7 @@ pub trait AudioTag: AudioTagCommon {
|
|||
|
||||
pub trait AudioTagCommon {
|
||||
fn config(&self) -> &Config;
|
||||
fn with_config(&self, config: Config) -> Box<dyn AudioTag>;
|
||||
fn set_config(&mut self, config: Config);
|
||||
fn into_anytag(&self) -> AnyTag<'_>;
|
||||
|
||||
/// Convert the tag type, which can be lossy.
|
||||
|
|
|
@ -27,8 +27,8 @@ fn test_convert_mp3_to_mp4() {
|
|||
Some(vec!["artist1 of mp4", "artist2 of mp4"])
|
||||
);
|
||||
// convert to id3 tag, which does not support multiple artists
|
||||
let mp3tag = mp4tag
|
||||
.with_config(Config::default().sep_artist("/")) // separator is by default `;`
|
||||
.into_tag(TagType::Id3v2);
|
||||
mp4tag.set_config(Config::default().sep_artist("/"));
|
||||
// separator is by default `;` but we can customise it
|
||||
let mp3tag = mp4tag.into_tag(TagType::Id3v2);
|
||||
assert_eq!(mp3tag.artist(), Some("artist1 of mp4/artist2 of mp4"));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue