@@ -14,15 +14,12 @@ use crate::{
1414 cli:: Request ,
1515 client:: { Client , PlayerRequest } ,
1616 config:: get_cache_folder_path,
17- state:: { Context , ContextId , Playback , PlaybackMetadata , SharedState } ,
18- } ;
19- use rspotify:: {
20- model:: {
21- AlbumId , ArtistId , CurrentPlaybackContext , Id , PlayableId , PlaylistId , SearchResult ,
22- SearchType , TrackId ,
17+ state:: {
18+ AlbumId , ArtistId , Context , ContextId , Id , PlayableId , Playback , PlaybackMetadata ,
19+ PlaylistId , SharedState , TrackId ,
2320 } ,
24- prelude:: { BaseClient , OAuthClient } ,
2521} ;
22+ use rspotify:: prelude:: { BaseClient , OAuthClient } ;
2623
2724use super :: {
2825 Command , Deserialize , GetRequest , IdOrName , ItemId , ItemType , Key , PlaylistCommand , Response ,
@@ -96,7 +93,7 @@ async fn send_response(
9693async fn current_playback (
9794 client : & Client ,
9895 state : Option < & SharedState > ,
99- ) -> Result < Option < CurrentPlaybackContext > > {
96+ ) -> Result < Option < rspotify :: model :: CurrentPlaybackContext > > {
10097 // get current playback from the application's state, if exists, or by making an API request
10198 match state {
10299 Some ( state) => Ok ( state. player . read ( ) . current_playback ( ) ) ,
@@ -230,11 +227,11 @@ async fn get_spotify_id(client: &Client, typ: ItemType, id_or_name: IdOrName) ->
230227 IdOrName :: Id ( id) => ItemId :: Playlist ( PlaylistId :: from_id ( id) ?) ,
231228 IdOrName :: Name ( name) => {
232229 let results = client
233- . search_specific_type ( & name, SearchType :: Playlist )
230+ . search_specific_type ( & name, rspotify :: model :: SearchType :: Playlist )
234231 . await ?;
235232
236233 match results {
237- SearchResult :: Playlists ( page) => {
234+ rspotify :: model :: SearchResult :: Playlists ( page) => {
238235 if page. items . is_empty ( ) {
239236 anyhow:: bail!( "Cannot find playlist with name='{name}'" ) ;
240237 }
@@ -248,11 +245,11 @@ async fn get_spotify_id(client: &Client, typ: ItemType, id_or_name: IdOrName) ->
248245 IdOrName :: Id ( id) => ItemId :: Album ( AlbumId :: from_id ( id) ?) ,
249246 IdOrName :: Name ( name) => {
250247 let results = client
251- . search_specific_type ( & name, SearchType :: Album )
248+ . search_specific_type ( & name, rspotify :: model :: SearchType :: Album )
252249 . await ?;
253250
254251 match results {
255- SearchResult :: Albums ( page) => {
252+ rspotify :: model :: SearchResult :: Albums ( page) => {
256253 if !page. items . is_empty ( ) && page. items [ 0 ] . id . is_some ( ) {
257254 ItemId :: Album ( page. items [ 0 ] . id . clone ( ) . unwrap ( ) )
258255 } else {
@@ -267,11 +264,11 @@ async fn get_spotify_id(client: &Client, typ: ItemType, id_or_name: IdOrName) ->
267264 IdOrName :: Id ( id) => ItemId :: Artist ( ArtistId :: from_id ( id) ?) ,
268265 IdOrName :: Name ( name) => {
269266 let results = client
270- . search_specific_type ( & name, SearchType :: Artist )
267+ . search_specific_type ( & name, rspotify :: model :: SearchType :: Artist )
271268 . await ?;
272269
273270 match results {
274- SearchResult :: Artists ( page) => {
271+ rspotify :: model :: SearchResult :: Artists ( page) => {
275272 if page. items . is_empty ( ) {
276273 anyhow:: bail!( "Cannot find artist with name='{name}'" ) ;
277274 }
@@ -285,11 +282,11 @@ async fn get_spotify_id(client: &Client, typ: ItemType, id_or_name: IdOrName) ->
285282 IdOrName :: Id ( id) => ItemId :: Track ( TrackId :: from_id ( id) ?) ,
286283 IdOrName :: Name ( name) => {
287284 let results = client
288- . search_specific_type ( & name, SearchType :: Track )
285+ . search_specific_type ( & name, rspotify :: model :: SearchType :: Track )
289286 . await ?;
290287
291288 match results {
292- SearchResult :: Tracks ( page) => {
289+ rspotify :: model :: SearchResult :: Tracks ( page) => {
293290 if !page. items . is_empty ( ) && page. items [ 0 ] . id . is_some ( ) {
294291 ItemId :: Track ( page. items [ 0 ] . id . clone ( ) . unwrap ( ) )
295292 } else {
0 commit comments