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(),