diff --git a/.gitignore b/.gitignore index 50c83018..956bf869 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,7 @@ Cargo.lock # These are backup files generated by rustfmt -**/*.rs.bk \ No newline at end of file +**/*.rs.bk + +# Project configuration +/.idea/ \ No newline at end of file diff --git a/src/components/flac_tag.rs b/src/components/flac_tag.rs index fcf116bc..3490b933 100644 --- a/src/components/flac_tag.rs +++ b/src/components/flac_tag.rs @@ -86,7 +86,7 @@ impl AudioTagEdit for FlacTag { } fn artists(&self) -> Option> { - todo!() + self.artist().map(|a| a.split(", ").collect()) } fn remove_artist(&mut self) { diff --git a/src/components/id3_tag.rs b/src/components/id3_tag.rs index 0f9fe038..3bd06607 100644 --- a/src/components/id3_tag.rs +++ b/src/components/id3_tag.rs @@ -91,7 +91,7 @@ impl AudioTagEdit for Id3v2Tag { } fn artists(&self) -> Option> { - todo!() + self.artist().map(|a| a.split(", ").collect()) } fn remove_artist(&mut self) { diff --git a/src/components/opus_tag.rs b/src/components/opus_tag.rs index 7a3459a7..dcec7d76 100644 --- a/src/components/opus_tag.rs +++ b/src/components/opus_tag.rs @@ -131,7 +131,7 @@ impl AudioTagEdit for OpusTag { } fn artists(&self) -> Option> { - todo!() + self.artist().map(|a| a.split(", ").collect()) } fn remove_artist(&mut self) { diff --git a/src/lib.rs b/src/lib.rs index 375f4a30..ce9fc86e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,15 +29,15 @@ //! use lofty::{Tag, TagType}; //! //! // Guess the format from the extension, in this case `mp3` -//! let mut tag = Tag::new().read_from_path("assets/a.mp3").unwrap(); +//! let mut tag = Tag::new().read_from_path("tests/assets/a.mp3").unwrap(); //! tag.set_title("Foo"); //! //! // You can convert the tag type and save the metadata to another file. -//! tag.to_dyn_tag(TagType::Mp4).write_to_path("assets/a.m4a"); +//! tag.to_dyn_tag(TagType::Mp4).write_to_path("tests/assets/a.m4a"); //! //! // You can specify the tag type, but when you want to do this //! // also consider directly using the concrete type -//! let tag = Tag::new().with_tag_type(TagType::Mp4).read_from_path("assets/a.m4a").unwrap(); +//! let tag = Tag::new().with_tag_type(TagType::Mp4).read_from_path("tests/assets/a.m4a").unwrap(); //! assert_eq!(tag.title(), Some("Foo")); //! ``` //! diff --git a/tests/inner.rs b/tests/inner.rs index 3d60186a..087705b6 100644 --- a/tests/inner.rs +++ b/tests/inner.rs @@ -9,11 +9,11 @@ fn test_inner() { let tag: FlacTag = innertag.into(); let mut id3tag = tag.to_dyn_tag(TagType::Id3v2); id3tag - .write_to_path("assets/a.mp3") + .write_to_path("tests/assets/a.mp3") .expect("Fail to write!"); let id3tag_reload = Tag::default() - .read_from_path("assets/a.mp3") + .read_from_path("tests/assets/a.mp3") .expect("Fail to read!"); assert_eq!(id3tag_reload.title(), Some("title from metaflac::Tag")); @@ -29,9 +29,9 @@ fn test_inner() { }; id3tag_inner.set_date_recorded(timestamp.clone()); id3tag_inner - .write_to_path("assets/a.mp3", id3::Version::Id3v24) + .write_to_path("tests/assets/a.mp3", id3::Version::Id3v24) .expect("Fail to write!"); - let id3tag_reload = id3::Tag::read_from_path("assets/a.mp3").expect("Fail to read!"); + let id3tag_reload = id3::Tag::read_from_path("tests/assets/a.mp3").expect("Fail to read!"); assert_eq!(id3tag_reload.date_recorded(), Some(timestamp)); }