chore: Update dependencies and remove unused code
This commit is contained in:
parent
f83b989f5e
commit
0ab90da6d6
8 changed files with 522 additions and 554 deletions
967
Cargo.lock
generated
967
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
44
Cargo.toml
44
Cargo.toml
|
|
@ -13,32 +13,32 @@ authors = ["exttex", "oSumAtrIX"]
|
|||
build = "build.rs"
|
||||
|
||||
[target.'cfg(windows)'.build-dependencies]
|
||||
winres = "0.1"
|
||||
winres = "0"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "4.2.1", features = ["cargo", "derive"] }
|
||||
log = "0.4"
|
||||
url = "2.2"
|
||||
protobuf = "3.1"
|
||||
base64 = "0.22.0"
|
||||
id3 = "1.14"
|
||||
dirs = "5.0.0"
|
||||
chrono = "0.4"
|
||||
lewton = "0.10"
|
||||
futures = "0.3"
|
||||
reqwest = "0.11"
|
||||
clap = { version = "4", features = ["cargo", "derive"] }
|
||||
log = "0"
|
||||
url = "2"
|
||||
protobuf = "3"
|
||||
base64 = "0"
|
||||
id3 = "1"
|
||||
dirs = "5"
|
||||
chrono = "0"
|
||||
lewton = "0"
|
||||
futures = "0"
|
||||
reqwest = "0"
|
||||
colored = "2"
|
||||
lame = "0.1"
|
||||
aspotify = "0.7.1"
|
||||
lame = "0"
|
||||
aspotify = "0"
|
||||
librespot = { git = "ssh://git@github.com/oSumAtrIX/free-librespot.git" }
|
||||
async-std = { version = "1.12", features = ["attributes", "tokio1"] }
|
||||
serde_json = "1.0"
|
||||
async-stream = "0.3"
|
||||
oggvorbismeta = "0.1"
|
||||
sanitize-filename = "0.5.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tokio = { version = "1.20", features = ["fs"] }
|
||||
env_logger = "0.11.1"
|
||||
async-std = { version = "1", features = ["attributes", "tokio1"] }
|
||||
serde_json = "1"
|
||||
async-stream = "0"
|
||||
oggvorbismeta = "0"
|
||||
sanitize-filename = "0"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
tokio = { version = "1", features = ["fs"] }
|
||||
env_logger = "0"
|
||||
|
||||
[package.metadata.winres]
|
||||
OriginalFilename = "DownOnSpot.exe"
|
||||
|
|
|
|||
|
|
@ -24,6 +24,6 @@ fn get_command() -> Command {
|
|||
"Settings file located at: {}",
|
||||
settings::get_config_settings_path().to_string_lossy()
|
||||
));
|
||||
let cli = Args::augment_args(cli);
|
||||
cli
|
||||
|
||||
Args::augment_args(cli)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use librespot::core::spotify_id::SpotifyId;
|
|||
use librespot::metadata::{FileFormat, Metadata, Track};
|
||||
use sanitize_filename::sanitize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt::Display;
|
||||
use std::io::Read;
|
||||
use std::path::{Path, PathBuf};
|
||||
use tokio::fs::File;
|
||||
|
|
@ -782,7 +783,6 @@ pub struct Download {
|
|||
pub id: i64,
|
||||
pub track_id: String,
|
||||
pub title: String,
|
||||
pub subtitle: String,
|
||||
pub state: DownloadState,
|
||||
}
|
||||
|
||||
|
|
@ -809,11 +809,6 @@ impl From<aspotify::Track> for Download {
|
|||
id: 0,
|
||||
track_id: val.id.unwrap(),
|
||||
title: val.name,
|
||||
subtitle: val
|
||||
.artists
|
||||
.first()
|
||||
.map(|a| a.name.to_owned())
|
||||
.unwrap_or_default(),
|
||||
state: DownloadState::None,
|
||||
}
|
||||
}
|
||||
|
|
@ -825,11 +820,6 @@ impl From<aspotify::TrackSimplified> for Download {
|
|||
id: 0,
|
||||
track_id: val.id.unwrap(),
|
||||
title: val.name,
|
||||
subtitle: val
|
||||
.artists
|
||||
.first()
|
||||
.map(|a| a.name.to_owned())
|
||||
.unwrap_or_default(),
|
||||
state: DownloadState::None,
|
||||
}
|
||||
}
|
||||
|
|
@ -863,15 +853,18 @@ pub enum Quality {
|
|||
Q96,
|
||||
}
|
||||
|
||||
impl ToString for Quality {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Quality::Q320 => "320kbps",
|
||||
Quality::Q256 => "256kbps",
|
||||
Quality::Q160 => "160kbps",
|
||||
Quality::Q96 => "96kbps",
|
||||
}
|
||||
.to_string()
|
||||
impl Display for Quality {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}",
|
||||
match self {
|
||||
Quality::Q320 => "320kbps",
|
||||
Quality::Q256 => "256kbps",
|
||||
Quality::Q160 => "160kbps",
|
||||
Quality::Q96 => "96kbps",
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
13
src/main.rs
13
src/main.rs
|
|
@ -15,7 +15,6 @@ use colored::Colorize;
|
|||
use downloader::{DownloadState, Downloader};
|
||||
use settings::Settings;
|
||||
use spotify::Spotify;
|
||||
use std::env;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[cfg(not(windows))]
|
||||
|
|
@ -153,10 +152,8 @@ async fn start() {
|
|||
for download in downloader.get_downloads().await {
|
||||
let state = download.state;
|
||||
|
||||
let progress: String;
|
||||
|
||||
if state != DownloadState::Done {
|
||||
progress = match state {
|
||||
let progress = if state != DownloadState::Done {
|
||||
match state {
|
||||
DownloadState::Downloading(r, t) => {
|
||||
exit_flag &= 0;
|
||||
let p = r as f32 / t as f32 * 100.0;
|
||||
|
|
@ -178,10 +175,10 @@ async fn start() {
|
|||
format!("{} ", e)
|
||||
}
|
||||
DownloadState::Done => "Impossible state".to_string(),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
progress = "Done.".to_string();
|
||||
}
|
||||
"Done.".to_string()
|
||||
};
|
||||
|
||||
println!("{:<19}| {}", progress, download.title);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,11 +48,7 @@ impl Spotify {
|
|||
Ok(Spotify {
|
||||
session,
|
||||
spotify,
|
||||
market: if let Some(countrycode) = market_country_code {
|
||||
Some(Market::Country(countrycode))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
market: market_country_code.map(Market::Country),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +203,7 @@ impl Clone for Spotify {
|
|||
Self {
|
||||
session: self.session.clone(),
|
||||
spotify: Client::new(self.spotify.credentials.clone()),
|
||||
market: self.market.clone(),
|
||||
market: self.market,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
use base64::Engine;
|
||||
use chrono::{Datelike, NaiveDate};
|
||||
use oggvorbismeta::{read_comment_header, replace_comment_header, CommentHeader, VorbisComments};
|
||||
use std::fs::File;
|
||||
|
|
@ -62,10 +61,8 @@ impl super::Tag for OggTag {
|
|||
picture.extend((data.len() as u32).to_be_bytes().iter());
|
||||
picture.extend(data);
|
||||
|
||||
self.tag.add_tag_single(
|
||||
"METADATA_BLOCK_PICTURE",
|
||||
&base64::engine::general_purpose::STANDARD.encode(picture),
|
||||
);
|
||||
self.tag
|
||||
.add_tag_single("METADATA_BLOCK_PICTURE", &base64::encode(picture));
|
||||
}
|
||||
|
||||
fn set_raw(&mut self, tag: &str, value: Vec<String>) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue