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