Update crate id3 and fix code

This commit is contained in:
oSumAtrIX 2022-01-30 22:00:23 +01:00
parent deacf5a23e
commit a371f73012
No known key found for this signature in database
GPG key ID: A9B3094ACDB604B4
4 changed files with 228 additions and 285 deletions

492
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,3 @@
cargo-features = ["strip"]
[profile.release]
strip = true
opt-level = "z"
@ -18,18 +16,18 @@ build = "build.rs"
winres = "0.1"
[dependencies]
clap = "2.33"
clap = "3.0"
log = "0.4"
url = "2.2"
protobuf = "2.25.0"
id3 = "0.6"
dirs = "3.0"
protobuf = "2.25"
id3 = "1.0"
dirs = "4.0"
chrono = "0.4"
lewton = "0.10"
futures = "0.3"
reqwest = "0.11"
colored = "2"
lame = "0.1.3"
lame = "0.1"
aspotify = "0.7"
librespot = { git = "ssh://git@github.com/oSumAtrIX/free-librespot.git", branch = "dev" }
async-std = { version = "1.10", features = ["attributes", "tokio1"] }

View file

@ -30,7 +30,6 @@ pub struct Settings {
fn get_config_folder_path() -> PathBuf {
match env::var("XDG_CONFIG_HOME") {
Ok(v) => Path::new(&v).join("down_on_spot").to_path_buf(),
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
#[cfg(target_family = "windows")]
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 {

View file

@ -1,6 +1,6 @@
use chrono::{Datelike, NaiveDate};
use id3::frame::{Picture, PictureType, Timestamp};
use id3::{Tag, Version};
use id3::{Tag, Version, TagLike};
use std::path::{Path, PathBuf};
use crate::error::SpotifyError;
@ -64,7 +64,7 @@ impl super::Tag for ID3Tag {
}
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(),
picture_type: PictureType::CoverFront,
description: "cover".to_string(),
@ -73,7 +73,7 @@ impl super::Tag for ID3Tag {
}
fn set_release_date(&mut self, date: NaiveDate) {
self.tag.set_date_recorded(Timestamp {
self.tag.set_date_released(Timestamp {
year: date.year(),
month: Some(date.month() as u8),
day: Some(date.day() as u8),