Update crate id3 and fix code
This commit is contained in:
parent
deacf5a23e
commit
a371f73012
4 changed files with 228 additions and 285 deletions
492
Cargo.lock
generated
492
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
12
Cargo.toml
12
Cargo.toml
|
|
@ -1,5 +1,3 @@
|
||||||
cargo-features = ["strip"]
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
strip = true
|
strip = true
|
||||||
opt-level = "z"
|
opt-level = "z"
|
||||||
|
|
@ -18,18 +16,18 @@ build = "build.rs"
|
||||||
winres = "0.1"
|
winres = "0.1"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = "2.33"
|
clap = "3.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
url = "2.2"
|
url = "2.2"
|
||||||
protobuf = "2.25.0"
|
protobuf = "2.25"
|
||||||
id3 = "0.6"
|
id3 = "1.0"
|
||||||
dirs = "3.0"
|
dirs = "4.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
lewton = "0.10"
|
lewton = "0.10"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
reqwest = "0.11"
|
reqwest = "0.11"
|
||||||
colored = "2"
|
colored = "2"
|
||||||
lame = "0.1.3"
|
lame = "0.1"
|
||||||
aspotify = "0.7"
|
aspotify = "0.7"
|
||||||
librespot = { git = "ssh://git@github.com/oSumAtrIX/free-librespot.git", branch = "dev" }
|
librespot = { git = "ssh://git@github.com/oSumAtrIX/free-librespot.git", branch = "dev" }
|
||||||
async-std = { version = "1.10", features = ["attributes", "tokio1"] }
|
async-std = { version = "1.10", features = ["attributes", "tokio1"] }
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ pub struct Settings {
|
||||||
fn get_config_folder_path() -> PathBuf {
|
fn get_config_folder_path() -> PathBuf {
|
||||||
match env::var("XDG_CONFIG_HOME") {
|
match env::var("XDG_CONFIG_HOME") {
|
||||||
Ok(v) => Path::new(&v).join("down_on_spot").to_path_buf(),
|
Ok(v) => Path::new(&v).join("down_on_spot").to_path_buf(),
|
||||||
|
|
||||||
Err(_) => Path::new(&env::var("HOME").unwrap()).join(".config/down_on_spot"),
|
Err(_) => Path::new(&env::var("HOME").unwrap()).join(".config/down_on_spot"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -38,7 +37,7 @@ fn get_config_folder_path() -> PathBuf {
|
||||||
// On Windows, follow whatever windows does for AppData
|
// On Windows, follow whatever windows does for AppData
|
||||||
#[cfg(target_family = "windows")]
|
#[cfg(target_family = "windows")]
|
||||||
fn get_config_folder_path() -> PathBuf {
|
fn get_config_folder_path() -> PathBuf {
|
||||||
Path::new(&env::var("APPDATA").unwrap()).join("down_on_spot");
|
Path::new(&env::var("APPDATA").unwrap()).join("down_on_spot")
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use chrono::{Datelike, NaiveDate};
|
use chrono::{Datelike, NaiveDate};
|
||||||
use id3::frame::{Picture, PictureType, Timestamp};
|
use id3::frame::{Picture, PictureType, Timestamp};
|
||||||
use id3::{Tag, Version};
|
use id3::{Tag, Version, TagLike};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use crate::error::SpotifyError;
|
use crate::error::SpotifyError;
|
||||||
|
|
@ -64,7 +64,7 @@ impl super::Tag for ID3Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add_cover(&mut self, mime: &str, data: Vec<u8>) {
|
fn add_cover(&mut self, mime: &str, data: Vec<u8>) {
|
||||||
self.tag.add_picture(Picture {
|
self.tag.add_frame(Picture {
|
||||||
mime_type: mime.to_owned(),
|
mime_type: mime.to_owned(),
|
||||||
picture_type: PictureType::CoverFront,
|
picture_type: PictureType::CoverFront,
|
||||||
description: "cover".to_string(),
|
description: "cover".to_string(),
|
||||||
|
|
@ -73,7 +73,7 @@ impl super::Tag for ID3Tag {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_release_date(&mut self, date: NaiveDate) {
|
fn set_release_date(&mut self, date: NaiveDate) {
|
||||||
self.tag.set_date_recorded(Timestamp {
|
self.tag.set_date_released(Timestamp {
|
||||||
year: date.year(),
|
year: date.year(),
|
||||||
month: Some(date.month() as u8),
|
month: Some(date.month() as u8),
|
||||||
day: Some(date.day() as u8),
|
day: Some(date.day() as u8),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue