From 30990304d937781f22949fcddf8b303d9b40ad07 Mon Sep 17 00:00:00 2001 From: Davide Polonio Date: Sun, 14 Jan 2024 19:08:12 +0100 Subject: [PATCH] chore: bump rspotify to latest version --- Cargo.toml | 2 +- src/search/spotify/mod.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 027e90d..0a47bb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ teloxide = { version = "0.9.2", features = ["auto-send", "macros"] } log = "0.4.17" pretty_env_logger = "0.5.0" tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] } -rspotify = { version = "0.11.7", features = ["default"]} +rspotify = { version = "0.12.0", features = ["default"]} sentry = "0.32.1" invidious = "0.2.1" itertools = "0.12.0" diff --git a/src/search/spotify/mod.rs b/src/search/spotify/mod.rs index 0104245..1336242 100644 --- a/src/search/spotify/mod.rs +++ b/src/search/spotify/mod.rs @@ -1,8 +1,9 @@ use async_trait::async_trait; #[cfg(test)] use mockall::{automock, mock, predicate::*}; +use rspotify::model::Country::UnitedStates; use rspotify::model::PlayableItem::{Episode, Track}; -use rspotify::model::{AlbumId, PlaylistId, TrackId}; +use rspotify::model::{AlbumId, PlaylistId, TrackId, Market}; use rspotify::prelude::*; use rspotify::{ClientCredsSpotify, Credentials}; use std::sync::Arc; @@ -99,7 +100,8 @@ impl SearchableClient for Client { Err(_e) => return None, }; - match self.client.track(track_id).await { + // Search track from US market + match self.client.track(track_id, Some(Market::Country(UnitedStates))).await { Ok(track) => Some(TrackInfo { name: track.name, artists: track.artists.iter().map(|x| x.name.clone()).collect(), @@ -115,7 +117,8 @@ impl SearchableClient for Client { Err(_e) => return None, }; - match self.client.album(album_id).await { + // Search album from US market + match self.client.album(album_id, Some(Market::Country(UnitedStates))).await { Ok(album) => Some(AlbumInfo { name: album.name, artists: album.artists.iter().map(|x| x.name.clone()).collect(),