From d48e86ae328af8d16521b94f15506628efdad15d Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Sun, 14 Jan 2024 11:37:54 +0100 Subject: [PATCH] chore: fix compilation errors --- src/search/spotify/mod.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/search/spotify/mod.rs b/src/search/spotify/mod.rs index 36e86a3..0104245 100644 --- a/src/search/spotify/mod.rs +++ b/src/search/spotify/mod.rs @@ -73,7 +73,7 @@ impl Client { pub(crate) async fn new() -> Self { let spotify_creds = Credentials::from_env() .expect("RSPOTIFY_CLIENT_ID and RSPOTIFY_CLIENT_SECRET not found."); - let mut spotify = ClientCredsSpotify::new(spotify_creds); + let spotify = ClientCredsSpotify::new(spotify_creds); spotify.request_token().await.unwrap(); Client { client: Arc::new(spotify), @@ -99,11 +99,11 @@ impl SearchableClient for Client { Err(_e) => return None, }; - match self.client.track(&track_id).await { + match self.client.track(track_id).await { Ok(track) => Some(TrackInfo { name: track.name, artists: track.artists.iter().map(|x| x.name.clone()).collect(), - duration: track.duration, + duration: Duration::from_secs(track.duration.num_seconds() as u64), }), Err(_e) => return None, } @@ -115,7 +115,7 @@ impl SearchableClient for Client { Err(_e) => return None, }; - match self.client.album(&album_id).await { + match self.client.album(album_id).await { Ok(album) => Some(AlbumInfo { name: album.name, artists: album.artists.iter().map(|x| x.name.clone()).collect(), @@ -127,7 +127,7 @@ impl SearchableClient for Client { .map(|t| TrackInfo { name: t.name.clone(), artists: t.artists.iter().map(|x| x.name.clone()).collect(), - duration: t.duration, + duration: Duration::from_secs(t.duration.num_seconds() as u64), }) .collect(), }), @@ -141,7 +141,7 @@ impl SearchableClient for Client { 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 { name: playlist.name, artists: playlist @@ -168,12 +168,12 @@ impl SearchableClient for Client { Track(t) => Some(PlayableKind::Track(TrackInfo { name: t.name.clone(), artists: t.artists.iter().map(|a| a.name.clone()).collect(), - duration: t.duration, + duration: Duration::from_secs(t.duration.num_seconds() as u64), })), Episode(e) => Some(PlayableKind::Podcast(EpisodeInfo { name: e.name.clone(), show: e.show.name.clone(), - duration: e.duration, + duration: Duration::from_secs(e.duration.num_seconds() as u64), description: e.description.clone(), languages: e.languages.clone(), release_date: e.release_date.clone(),