Skip to content

Commit

Permalink
upload to crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
zggff committed Dec 9, 2021
1 parent f77d78e commit ef12f81
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/target
/output
5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ version = "0.1.0"
edition = "2021"
authors = ["zggff<[email protected]>"]
license = "MIT OR Apache-2.0"

repository = "https://github.com/zggff/deezer_downloader"
homepage = "https://github.com/zggff/deezer_downloader"
readme = "README.md"
keywords = ["deezer", "downloader"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
Empty file removed song.mp3
Empty file.
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ mod tests {
async fn download_song_by_id() -> Result<(), Box<dyn Error>> {
let mut downloader = Downloader::new().await?;
let song = downloader.download_song(92719900).await?;
song.write(format!("{}.mp3", song.metadata.id))?;
// file.write(&song)?;

song.write_to_file(format!("output/{}.mp3", song.metadata.id))?;
Ok(())
}
}
2 changes: 1 addition & 1 deletion src/song.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Song {
}

/// write song to file
pub fn write<P: AsRef<Path>>(&self, path: P) -> Result<(), Box<dyn Error>> {
pub fn write_to_file(&self, path: impl AsRef<Path>) -> Result<(), Box<dyn Error>> {
let mut file = File::create(&path)?;
file.write_all(&self.content)?;
self.tag.write_to_path(path, id3::Version::Id3v24)?;
Expand Down

0 comments on commit ef12f81

Please sign in to comment.