chore: Lint code
This commit is contained in:
parent
3887369735
commit
e2c7ba5d58
3 changed files with 7 additions and 11 deletions
|
|
@ -1 +0,0 @@
|
||||||
nightly
|
|
||||||
|
|
@ -64,9 +64,7 @@ impl Downloader {
|
||||||
input: &str,
|
input: &str,
|
||||||
) -> Result<Option<Vec<SearchResult>>, SpotifyError> {
|
) -> Result<Option<Vec<SearchResult>>, SpotifyError> {
|
||||||
if let Ok(uri) = Spotify::parse_uri(input) {
|
if let Ok(uri) = Spotify::parse_uri(input) {
|
||||||
if let Err(e) = self.add_uri(&uri).await {
|
self.add_uri(&uri).await?;
|
||||||
return Err(e);
|
|
||||||
}
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
} else {
|
} else {
|
||||||
let results: Vec<SearchResult> = self
|
let results: Vec<SearchResult> = self
|
||||||
|
|
@ -301,7 +299,7 @@ impl DownloaderInternal {
|
||||||
(
|
(
|
||||||
"%artist%",
|
"%artist%",
|
||||||
sanitize(
|
sanitize(
|
||||||
&track
|
track
|
||||||
.artists
|
.artists
|
||||||
.iter()
|
.iter()
|
||||||
.map(|a| a.name.as_str())
|
.map(|a| a.name.as_str())
|
||||||
|
|
@ -313,7 +311,7 @@ impl DownloaderInternal {
|
||||||
(
|
(
|
||||||
"%artists%",
|
"%artists%",
|
||||||
sanitize(
|
sanitize(
|
||||||
&track
|
track
|
||||||
.artists
|
.artists
|
||||||
.iter()
|
.iter()
|
||||||
.map(|a| a.name.as_str())
|
.map(|a| a.name.as_str())
|
||||||
|
|
@ -330,7 +328,7 @@ impl DownloaderInternal {
|
||||||
(
|
(
|
||||||
"%albumArtist%",
|
"%albumArtist%",
|
||||||
sanitize(
|
sanitize(
|
||||||
&track
|
track
|
||||||
.album
|
.album
|
||||||
.artists
|
.artists
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -343,7 +341,7 @@ impl DownloaderInternal {
|
||||||
(
|
(
|
||||||
"%albumArtists%",
|
"%albumArtists%",
|
||||||
sanitize(
|
sanitize(
|
||||||
&track
|
track
|
||||||
.album
|
.album
|
||||||
.artists
|
.artists
|
||||||
.iter()
|
.iter()
|
||||||
|
|
@ -475,13 +473,13 @@ impl DownloaderInternal {
|
||||||
|
|
||||||
async fn find_alternative(session: &Session, track: Track) -> Result<Track, SpotifyError> {
|
async fn find_alternative(session: &Session, track: Track) -> Result<Track, SpotifyError> {
|
||||||
for alt in track.alternatives {
|
for alt in track.alternatives {
|
||||||
let t = Track::get(&session, alt).await?;
|
let t = Track::get(session, alt).await?;
|
||||||
if !t.available {
|
if !t.available {
|
||||||
return Ok(t);
|
return Ok(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Err(SpotifyError::Unavailable);
|
Err(SpotifyError::Unavailable)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Download track by id
|
/// Download track by id
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ async fn main() {
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
use colored::control;
|
use colored::control;
|
||||||
use std::os::windows::process;
|
|
||||||
|
|
||||||
//backwards compatibility.
|
//backwards compatibility.
|
||||||
if control::set_virtual_terminal(true).is_ok() {};
|
if control::set_virtual_terminal(true).is_ok() {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue