Upgrade rspotify to 0.11.6
Passing IDs to rspotify still feels a little wonky with their `Id` changes making use of `Cow`. Maybe it can be simplified on our end, but it's a start. Fixes #844 See also: https://github.com/ramsayleung/rspotify/pull/332
This commit is contained in:
79
Cargo.lock
generated
79
Cargo.lock
generated
@@ -4,9 +4,9 @@ version = 3
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
version = "0.17.0"
|
||||
version = "0.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b"
|
||||
checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97"
|
||||
dependencies = [
|
||||
"gimli",
|
||||
]
|
||||
@@ -131,9 +131,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
||||
|
||||
[[package]]
|
||||
name = "backtrace"
|
||||
version = "0.3.66"
|
||||
version = "0.3.67"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7"
|
||||
checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca"
|
||||
dependencies = [
|
||||
"addr2line",
|
||||
"cc",
|
||||
@@ -791,6 +791,18 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enum_dispatch"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0eb359f1476bf611266ac1f5355bc14aeca37b299d0ebccc038ee7058891c9cb"
|
||||
dependencies = [
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "enumset"
|
||||
version = "1.0.12"
|
||||
@@ -999,9 +1011,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "gimli"
|
||||
version = "0.26.2"
|
||||
version = "0.27.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
|
||||
checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793"
|
||||
|
||||
[[package]]
|
||||
name = "glob"
|
||||
@@ -1285,9 +1297,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.5.1"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745"
|
||||
checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e"
|
||||
|
||||
[[package]]
|
||||
name = "is-terminal"
|
||||
@@ -1570,9 +1582,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "linux-raw-sys"
|
||||
version = "0.1.3"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
|
||||
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
|
||||
|
||||
[[package]]
|
||||
name = "lock_api"
|
||||
@@ -1676,9 +1688,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.5.4"
|
||||
version = "0.6.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34"
|
||||
checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa"
|
||||
dependencies = [
|
||||
"adler",
|
||||
]
|
||||
@@ -2080,9 +2092,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "object"
|
||||
version = "0.29.0"
|
||||
version = "0.30.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
|
||||
checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
@@ -2222,7 +2234,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99"
|
||||
dependencies = [
|
||||
"instant",
|
||||
"lock_api",
|
||||
"parking_lot_core 0.8.5",
|
||||
"parking_lot_core 0.8.6",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2237,9 +2249,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "parking_lot_core"
|
||||
version = "0.8.5"
|
||||
version = "0.8.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216"
|
||||
checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"instant",
|
||||
@@ -2619,9 +2631,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rspotify"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1e20ceabb52376647badaaf6d65dd068c963537dd82c705cd0af7621132a0bb"
|
||||
checksum = "a86007448fb9a88a0677fd332addf8e7c1057e67bc385d3477c8d44c1bb0e96f"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"chrono",
|
||||
@@ -2640,9 +2652,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rspotify-http"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fe28fe911336a08629c48241988d9f6f338babb69ef18d00d9bfdc7280ceb95"
|
||||
checksum = "aa7481b3155d1ee3a0a73f94148d3385487e519b795d418ec0df1588961c1105"
|
||||
dependencies = [
|
||||
"log",
|
||||
"maybe-async",
|
||||
@@ -2653,17 +2665,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "rspotify-macros"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "47716be06c31041cca54ba9023e205969a91825b84f7196bbb60724b1e6fdfa9"
|
||||
checksum = "0c86521fc751c75235937f0014dfb17e67f8abc6461b28ad82c9c2acc33a0c47"
|
||||
|
||||
[[package]]
|
||||
name = "rspotify-model"
|
||||
version = "0.11.5"
|
||||
version = "0.11.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "989a2221f58bd204ab6f3f98681511dc94eb843c5ae5db379012fc1769853736"
|
||||
checksum = "3b03296b02fc44c9b792635cf8156d13b9d0edf629d74e80c4f551a97a1b83cd"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"enum_dispatch",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"strum 0.24.1",
|
||||
@@ -2807,9 +2820,9 @@ checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.149"
|
||||
version = "1.0.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "256b9932320c590e707b94576e3cc1f7c9024d0ee6612dfbcf1cb106cbe8e055"
|
||||
checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@@ -2826,9 +2839,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.149"
|
||||
version = "1.0.150"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b4eae9b04cbffdfd550eb462ed33bc6a1b68c935127d008b27444d08380f94e4"
|
||||
checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -3251,9 +3264,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.9"
|
||||
version = "0.5.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
|
||||
checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -3592,9 +3605,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "webpki-roots"
|
||||
version = "0.22.5"
|
||||
version = "0.22.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be"
|
||||
checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87"
|
||||
dependencies = [
|
||||
"webpki",
|
||||
]
|
||||
|
||||
@@ -141,6 +141,19 @@ impl From<&PlayableItem> for Playable {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<&Playable> for rspotify::prelude::PlayableId<'_> {
|
||||
fn from(p: &Playable) -> Self {
|
||||
match p {
|
||||
Playable::Track(t) => rspotify::prelude::PlayableId::Track(
|
||||
rspotify::model::TrackId::from_id(t.id.clone().unwrap()).unwrap(),
|
||||
),
|
||||
Playable::Episode(e) => rspotify::prelude::PlayableId::Episode(
|
||||
rspotify::model::EpisodeId::from_id(e.id.clone()).unwrap(),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Playable {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
|
||||
@@ -151,17 +151,9 @@ impl WebApi {
|
||||
position: Option<i32>,
|
||||
) -> bool {
|
||||
self.api_with_retry(|api| {
|
||||
let trackids: Vec<Box<dyn PlayableId>> = tracks
|
||||
.iter()
|
||||
.map(|playable| {
|
||||
Box::new(
|
||||
TrackId::from_id(playable.id().as_ref().unwrap_or(&"".to_string()))
|
||||
.unwrap(),
|
||||
) as Box<dyn PlayableId>
|
||||
})
|
||||
.collect();
|
||||
let trackids: Vec<PlayableId> = tracks.iter().map(|playable| playable.into()).collect();
|
||||
api.playlist_add_items(
|
||||
&PlaylistId::from_id(playlist_id).unwrap(),
|
||||
PlaylistId::from_id(playlist_id).unwrap(),
|
||||
trackids.iter().map(|id| id.as_ref()),
|
||||
position,
|
||||
)
|
||||
@@ -176,18 +168,8 @@ impl WebApi {
|
||||
playables: &[Playable],
|
||||
) -> bool {
|
||||
self.api_with_retry(move |api| {
|
||||
let playable_ids: Vec<Box<dyn PlayableId>> = playables
|
||||
.iter()
|
||||
.map(|playable| match playable {
|
||||
Playable::Track(track) => {
|
||||
Box::new(TrackId::from_id(&track.id.clone().unwrap_or_default()).unwrap())
|
||||
as Box<dyn PlayableId>
|
||||
}
|
||||
Playable::Episode(episode) => {
|
||||
Box::new(EpisodeId::from_id(&episode.id).unwrap()) as Box<dyn PlayableId>
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let playable_ids: Vec<PlayableId> =
|
||||
playables.iter().map(|playable| playable.into()).collect();
|
||||
let positions = playables
|
||||
.iter()
|
||||
.map(|playable| [playable.list_index() as u32])
|
||||
@@ -201,7 +183,7 @@ impl WebApi {
|
||||
})
|
||||
.collect();
|
||||
api.playlist_remove_specific_occurrences_of_items(
|
||||
&PlaylistId::from_id(playlist_id).unwrap(),
|
||||
PlaylistId::from_id(playlist_id).unwrap(),
|
||||
item_pos,
|
||||
Some(snapshot_id),
|
||||
)
|
||||
@@ -221,20 +203,10 @@ impl WebApi {
|
||||
};
|
||||
|
||||
if let Some(()) = self.api_with_retry(|api| {
|
||||
let playable_ids: Vec<Box<dyn PlayableId>> = tracks
|
||||
.iter()
|
||||
.map(|playable| match playable {
|
||||
Playable::Track(track) => {
|
||||
Box::new(TrackId::from_id(&track.id.clone().unwrap_or_default()).unwrap())
|
||||
as Box<dyn PlayableId>
|
||||
}
|
||||
Playable::Episode(episode) => {
|
||||
Box::new(EpisodeId::from_id(&episode.id).unwrap()) as Box<dyn PlayableId>
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
let playable_ids: Vec<PlayableId> =
|
||||
tracks.iter().map(|playable| playable.into()).collect();
|
||||
api.playlist_replace_items(
|
||||
&PlaylistId::from_id(id).unwrap(),
|
||||
PlaylistId::from_id(id).unwrap(),
|
||||
playable_ids.iter().map(|p| p.as_ref()),
|
||||
)
|
||||
}) {
|
||||
@@ -261,7 +233,7 @@ impl WebApi {
|
||||
}
|
||||
|
||||
pub fn delete_playlist(&self, id: &str) -> bool {
|
||||
self.api_with_retry(|api| api.playlist_unfollow(&PlaylistId::from_id(id).unwrap()))
|
||||
self.api_with_retry(|api| api.playlist_unfollow(PlaylistId::from_id(id).unwrap()))
|
||||
.is_some()
|
||||
}
|
||||
|
||||
@@ -273,7 +245,7 @@ impl WebApi {
|
||||
) -> Option<String> {
|
||||
let result = self.api_with_retry(|api| {
|
||||
api.user_playlist_create(
|
||||
&UserId::from_id(self.user.as_ref().unwrap()).unwrap(),
|
||||
UserId::from_id(self.user.as_ref().unwrap()).unwrap(),
|
||||
name,
|
||||
public,
|
||||
None,
|
||||
@@ -285,32 +257,32 @@ impl WebApi {
|
||||
|
||||
pub fn album(&self, album_id: &str) -> Option<FullAlbum> {
|
||||
let aid = AlbumId::from_id(album_id).ok()?;
|
||||
self.api_with_retry(|api| api.album(&aid))
|
||||
self.api_with_retry(|api| api.album(aid.clone()))
|
||||
}
|
||||
|
||||
pub fn artist(&self, artist_id: &str) -> Option<FullArtist> {
|
||||
let aid = ArtistId::from_id(artist_id).ok()?;
|
||||
self.api_with_retry(|api| api.artist(&aid))
|
||||
self.api_with_retry(|api| api.artist(aid.clone()))
|
||||
}
|
||||
|
||||
pub fn playlist(&self, playlist_id: &str) -> Option<FullPlaylist> {
|
||||
let pid = PlaylistId::from_id(playlist_id).ok()?;
|
||||
self.api_with_retry(|api| api.playlist(&pid, None, Some(&Market::FromToken)))
|
||||
self.api_with_retry(|api| api.playlist(pid.clone(), None, Some(Market::FromToken)))
|
||||
}
|
||||
|
||||
pub fn track(&self, track_id: &str) -> Option<FullTrack> {
|
||||
let tid = TrackId::from_id(track_id).ok()?;
|
||||
self.api_with_retry(|api| api.track(&tid))
|
||||
self.api_with_retry(|api| api.track(tid.clone()))
|
||||
}
|
||||
|
||||
pub fn get_show(&self, show_id: &str) -> Option<FullShow> {
|
||||
let sid = ShowId::from_id(show_id).ok()?;
|
||||
self.api_with_retry(|api| api.get_a_show(&sid, Some(&Market::FromToken)))
|
||||
self.api_with_retry(|api| api.get_a_show(sid.clone(), Some(Market::FromToken)))
|
||||
}
|
||||
|
||||
pub fn episode(&self, episode_id: &str) -> Option<FullEpisode> {
|
||||
let eid = EpisodeId::from_id(episode_id).ok()?;
|
||||
self.api_with_retry(|api| api.get_an_episode(&eid, Some(&Market::FromToken)))
|
||||
self.api_with_retry(|api| api.get_an_episode(eid.clone(), Some(Market::FromToken)))
|
||||
}
|
||||
|
||||
pub fn recommendations(
|
||||
@@ -323,21 +295,21 @@ impl WebApi {
|
||||
let seed_artistids = seed_artists.as_ref().map(|artistids| {
|
||||
artistids
|
||||
.iter()
|
||||
.map(|id| ArtistId::from_id(id).unwrap())
|
||||
.map(|id| ArtistId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<ArtistId>>()
|
||||
});
|
||||
let seed_trackids = seed_tracks.as_ref().map(|trackids| {
|
||||
trackids
|
||||
.iter()
|
||||
.map(|id| TrackId::from_id(id).unwrap())
|
||||
.map(|id| TrackId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<TrackId>>()
|
||||
});
|
||||
api.recommendations(
|
||||
std::iter::empty(),
|
||||
seed_artistids.as_ref(),
|
||||
seed_artistids,
|
||||
seed_genres.clone(),
|
||||
seed_trackids.as_ref(),
|
||||
Some(&Market::FromToken),
|
||||
seed_trackids,
|
||||
Some(Market::FromToken),
|
||||
Some(100),
|
||||
)
|
||||
})
|
||||
@@ -353,8 +325,8 @@ impl WebApi {
|
||||
self.api_with_retry(|api| {
|
||||
api.search(
|
||||
query,
|
||||
&searchtype,
|
||||
Some(&Market::FromToken),
|
||||
searchtype,
|
||||
Some(Market::FromToken),
|
||||
None,
|
||||
Some(limit),
|
||||
Some(offset),
|
||||
@@ -393,9 +365,9 @@ impl WebApi {
|
||||
);
|
||||
spotify.api_with_retry(|api| {
|
||||
match api.playlist_items_manual(
|
||||
&PlaylistId::from_id(&playlist_id).unwrap(),
|
||||
PlaylistId::from_id(&playlist_id).unwrap(),
|
||||
None,
|
||||
Some(&Market::FromToken),
|
||||
Some(Market::FromToken),
|
||||
Some(MAX_LIMIT),
|
||||
Some(offset),
|
||||
) {
|
||||
@@ -425,7 +397,7 @@ impl WebApi {
|
||||
}
|
||||
|
||||
pub fn full_album(&self, album_id: &str) -> Option<FullAlbum> {
|
||||
self.api_with_retry(|api| api.album(&AlbumId::from_id(album_id).unwrap()))
|
||||
self.api_with_retry(|api| api.album(AlbumId::from_id(album_id).unwrap()))
|
||||
}
|
||||
|
||||
pub fn album_tracks(
|
||||
@@ -436,7 +408,7 @@ impl WebApi {
|
||||
) -> Option<Page<SimplifiedTrack>> {
|
||||
self.api_with_retry(|api| {
|
||||
api.album_track_manual(
|
||||
&AlbumId::from_id(album_id).unwrap(),
|
||||
AlbumId::from_id(album_id).unwrap(),
|
||||
Some(limit),
|
||||
Some(offset),
|
||||
)
|
||||
@@ -455,9 +427,9 @@ impl WebApi {
|
||||
debug!("fetching artist {} albums, offset: {}", artist_id, offset);
|
||||
spotify.api_with_retry(|api| {
|
||||
match api.artist_albums_manual(
|
||||
&ArtistId::from_id(&artist_id).unwrap(),
|
||||
album_type.as_ref(),
|
||||
Some(&Market::FromToken),
|
||||
ArtistId::from_id(&artist_id).unwrap(),
|
||||
album_type.as_ref().copied(),
|
||||
Some(Market::FromToken),
|
||||
Some(MAX_SIZE),
|
||||
Some(offset),
|
||||
) {
|
||||
@@ -487,8 +459,8 @@ impl WebApi {
|
||||
debug!("fetching show {} episodes, offset: {}", &show_id, offset);
|
||||
spotify.api_with_retry(|api| {
|
||||
match api.get_shows_episodes_manual(
|
||||
&ShowId::from_id(&show_id).unwrap(),
|
||||
Some(&Market::FromToken),
|
||||
ShowId::from_id(&show_id).unwrap(),
|
||||
Some(Market::FromToken),
|
||||
Some(50),
|
||||
Some(offset),
|
||||
) {
|
||||
@@ -512,8 +484,8 @@ impl WebApi {
|
||||
pub fn save_shows(&self, ids: Vec<&str>) -> bool {
|
||||
self.api_with_retry(|api| {
|
||||
api.save_shows(
|
||||
&ids.iter()
|
||||
.map(|id| ShowId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| ShowId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<ShowId>>(),
|
||||
)
|
||||
})
|
||||
@@ -523,10 +495,10 @@ impl WebApi {
|
||||
pub fn unsave_shows(&self, ids: Vec<&str>) -> bool {
|
||||
self.api_with_retry(|api| {
|
||||
api.remove_users_saved_shows(
|
||||
&ids.iter()
|
||||
.map(|id| ShowId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| ShowId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<ShowId>>(),
|
||||
Some(&Market::FromToken),
|
||||
Some(Market::FromToken),
|
||||
)
|
||||
})
|
||||
.is_some()
|
||||
@@ -542,8 +514,8 @@ impl WebApi {
|
||||
pub fn user_follow_artists(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.user_follow_artists(
|
||||
&ids.iter()
|
||||
.map(|id| ArtistId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| ArtistId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<ArtistId>>(),
|
||||
)
|
||||
})
|
||||
@@ -552,8 +524,8 @@ impl WebApi {
|
||||
pub fn user_unfollow_artists(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.user_unfollow_artists(
|
||||
&ids.iter()
|
||||
.map(|id| ArtistId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| ArtistId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<ArtistId>>(),
|
||||
)
|
||||
})
|
||||
@@ -561,15 +533,15 @@ impl WebApi {
|
||||
|
||||
pub fn current_user_saved_albums(&self, offset: u32) -> Option<Page<SavedAlbum>> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_albums_manual(Some(&Market::FromToken), Some(50), Some(offset))
|
||||
api.current_user_saved_albums_manual(Some(Market::FromToken), Some(50), Some(offset))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn current_user_saved_albums_add(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_albums_add(
|
||||
&ids.iter()
|
||||
.map(|id| AlbumId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| AlbumId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<AlbumId>>(),
|
||||
)
|
||||
})
|
||||
@@ -578,8 +550,8 @@ impl WebApi {
|
||||
pub fn current_user_saved_albums_delete(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_albums_delete(
|
||||
&ids.iter()
|
||||
.map(|id| AlbumId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| AlbumId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<AlbumId>>(),
|
||||
)
|
||||
})
|
||||
@@ -587,15 +559,15 @@ impl WebApi {
|
||||
|
||||
pub fn current_user_saved_tracks(&self, offset: u32) -> Option<Page<SavedTrack>> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_tracks_manual(Some(&Market::FromToken), Some(50), Some(offset))
|
||||
api.current_user_saved_tracks_manual(Some(Market::FromToken), Some(50), Some(offset))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn current_user_saved_tracks_add(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_tracks_add(
|
||||
&ids.iter()
|
||||
.map(|id| TrackId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| TrackId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<TrackId>>(),
|
||||
)
|
||||
})
|
||||
@@ -604,26 +576,26 @@ impl WebApi {
|
||||
pub fn current_user_saved_tracks_delete(&self, ids: Vec<&str>) -> Option<()> {
|
||||
self.api_with_retry(|api| {
|
||||
api.current_user_saved_tracks_delete(
|
||||
&ids.iter()
|
||||
.map(|id| TrackId::from_id(id).unwrap())
|
||||
ids.iter()
|
||||
.map(|id| TrackId::from_id(id.clone()).unwrap())
|
||||
.collect::<Vec<TrackId>>(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn user_playlist_follow_playlist(&self, id: &str) -> Option<()> {
|
||||
self.api_with_retry(|api| api.playlist_follow(&PlaylistId::from_id(id).unwrap(), None))
|
||||
self.api_with_retry(|api| api.playlist_follow(PlaylistId::from_id(id).unwrap(), None))
|
||||
}
|
||||
|
||||
pub fn artist_top_tracks(&self, id: &str) -> Option<Vec<Track>> {
|
||||
self.api_with_retry(|api| {
|
||||
api.artist_top_tracks(&ArtistId::from_id(id).unwrap(), &Market::FromToken)
|
||||
api.artist_top_tracks(ArtistId::from_id(id).unwrap(), Market::FromToken)
|
||||
})
|
||||
.map(|ft| ft.iter().map(|t| t.into()).collect())
|
||||
}
|
||||
|
||||
pub fn artist_related_artists(&self, id: &str) -> Option<Vec<Artist>> {
|
||||
self.api_with_retry(|api| api.artist_related_artists(&ArtistId::from_id(id).unwrap()))
|
||||
self.api_with_retry(|api| api.artist_related_artists(ArtistId::from_id(id).unwrap()))
|
||||
.map(|fa| fa.iter().map(|a| a.into()).collect())
|
||||
}
|
||||
|
||||
@@ -635,7 +607,7 @@ impl WebApi {
|
||||
spotify.api_with_retry(|api| {
|
||||
match api.categories_manual(
|
||||
None,
|
||||
Some(&Market::FromToken),
|
||||
Some(Market::FromToken),
|
||||
Some(MAX_LIMIT),
|
||||
Some(offset),
|
||||
) {
|
||||
@@ -660,7 +632,7 @@ impl WebApi {
|
||||
spotify.api_with_retry(|api| {
|
||||
match api.category_playlists_manual(
|
||||
&category_id,
|
||||
Some(&Market::FromToken),
|
||||
Some(Market::FromToken),
|
||||
Some(MAX_LIMIT),
|
||||
Some(offset),
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user