Compare commits
No commits in common. "532773c209e041b8170aab8ed5c2b5608abab146" and "571de470d96a6aa19b68317a879c45faa817aec7" have entirely different histories.
532773c209
...
571de470d9
|
@ -8,12 +8,13 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
teloxide = { version = "0.9.2", features = ["auto-send", "macros"] }
|
teloxide = { version = "0.9.2", features = ["auto-send", "macros"] }
|
||||||
log = "0.4.17"
|
log = "0.4.17"
|
||||||
pretty_env_logger = "0.5.0"
|
pretty_env_logger = "0.4.0"
|
||||||
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] }
|
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] }
|
||||||
rspotify = { version = "0.11.5", features = ["default"]}
|
rspotify = { version = "0.11.5", features = ["default"]}
|
||||||
sentry = "0.32.1"
|
sentry = "0.27.0"
|
||||||
invidious = "0.2.1"
|
invidious = "0.2.1"
|
||||||
itertools = "0.12.0"
|
chrono = "0.4.19"
|
||||||
|
itertools = "0.10.3"
|
||||||
async-trait = "0.1.56"
|
async-trait = "0.1.56"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
|
|
|
@ -73,7 +73,7 @@ impl Client {
|
||||||
pub(crate) async fn new() -> Self {
|
pub(crate) async fn new() -> Self {
|
||||||
let spotify_creds = Credentials::from_env()
|
let spotify_creds = Credentials::from_env()
|
||||||
.expect("RSPOTIFY_CLIENT_ID and RSPOTIFY_CLIENT_SECRET not found.");
|
.expect("RSPOTIFY_CLIENT_ID and RSPOTIFY_CLIENT_SECRET not found.");
|
||||||
let spotify = ClientCredsSpotify::new(spotify_creds);
|
let mut spotify = ClientCredsSpotify::new(spotify_creds);
|
||||||
spotify.request_token().await.unwrap();
|
spotify.request_token().await.unwrap();
|
||||||
Client {
|
Client {
|
||||||
client: Arc::new(spotify),
|
client: Arc::new(spotify),
|
||||||
|
@ -99,11 +99,11 @@ impl SearchableClient for Client {
|
||||||
Err(_e) => return None,
|
Err(_e) => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
match self.client.track(track_id).await {
|
match self.client.track(&track_id).await {
|
||||||
Ok(track) => Some(TrackInfo {
|
Ok(track) => Some(TrackInfo {
|
||||||
name: track.name,
|
name: track.name,
|
||||||
artists: track.artists.iter().map(|x| x.name.clone()).collect(),
|
artists: track.artists.iter().map(|x| x.name.clone()).collect(),
|
||||||
duration: Duration::from_secs(track.duration.num_seconds() as u64),
|
duration: track.duration,
|
||||||
}),
|
}),
|
||||||
Err(_e) => return None,
|
Err(_e) => return None,
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ impl SearchableClient for Client {
|
||||||
Err(_e) => return None,
|
Err(_e) => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
match self.client.album(album_id).await {
|
match self.client.album(&album_id).await {
|
||||||
Ok(album) => Some(AlbumInfo {
|
Ok(album) => Some(AlbumInfo {
|
||||||
name: album.name,
|
name: album.name,
|
||||||
artists: album.artists.iter().map(|x| x.name.clone()).collect(),
|
artists: album.artists.iter().map(|x| x.name.clone()).collect(),
|
||||||
|
@ -127,7 +127,7 @@ impl SearchableClient for Client {
|
||||||
.map(|t| TrackInfo {
|
.map(|t| TrackInfo {
|
||||||
name: t.name.clone(),
|
name: t.name.clone(),
|
||||||
artists: t.artists.iter().map(|x| x.name.clone()).collect(),
|
artists: t.artists.iter().map(|x| x.name.clone()).collect(),
|
||||||
duration: Duration::from_secs(t.duration.num_seconds() as u64),
|
duration: t.duration,
|
||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
}),
|
}),
|
||||||
|
@ -141,7 +141,7 @@ impl SearchableClient for Client {
|
||||||
Err(_e) => return None,
|
Err(_e) => return None,
|
||||||
};
|
};
|
||||||
|
|
||||||
match self.client.playlist(playlist_id, None, None).await {
|
match self.client.playlist(&playlist_id, None, None).await {
|
||||||
Ok(playlist) => Some(PlaylistInfo {
|
Ok(playlist) => Some(PlaylistInfo {
|
||||||
name: playlist.name,
|
name: playlist.name,
|
||||||
artists: playlist
|
artists: playlist
|
||||||
|
@ -168,12 +168,12 @@ impl SearchableClient for Client {
|
||||||
Track(t) => Some(PlayableKind::Track(TrackInfo {
|
Track(t) => Some(PlayableKind::Track(TrackInfo {
|
||||||
name: t.name.clone(),
|
name: t.name.clone(),
|
||||||
artists: t.artists.iter().map(|a| a.name.clone()).collect(),
|
artists: t.artists.iter().map(|a| a.name.clone()).collect(),
|
||||||
duration: Duration::from_secs(t.duration.num_seconds() as u64),
|
duration: t.duration,
|
||||||
})),
|
})),
|
||||||
Episode(e) => Some(PlayableKind::Podcast(EpisodeInfo {
|
Episode(e) => Some(PlayableKind::Podcast(EpisodeInfo {
|
||||||
name: e.name.clone(),
|
name: e.name.clone(),
|
||||||
show: e.show.name.clone(),
|
show: e.show.name.clone(),
|
||||||
duration: Duration::from_secs(e.duration.num_seconds() as u64),
|
duration: e.duration,
|
||||||
description: e.description.clone(),
|
description: e.description.clone(),
|
||||||
languages: e.languages.clone(),
|
languages: e.languages.clone(),
|
||||||
release_date: e.release_date.clone(),
|
release_date: e.release_date.clone(),
|
||||||
|
|
Loading…
Reference in New Issue