diff --git a/spotify/spotify_actions.go b/spotify/spotify_actions.go index 6846b2d..b70abe2 100644 --- a/spotify/spotify_actions.go +++ b/spotify/spotify_actions.go @@ -11,6 +11,7 @@ import ( func (spotify *Spotify) shutdownSpotify() { spotify.session.Logout() + spotify.session.Close() spotify.initCache() spotify.events.ShutdownEngine() } @@ -72,7 +73,8 @@ func (spotify *Spotify) search(query string) { playlist := sconsify.InitSearchPlaylist(name, name, func(playlist *sconsify.Playlist) { options := createWebSpotifyOptions(50, playlist.Tracks()) - if searchResult, err := spotify.getWebApiClient().SearchOpt(query, webspotify.SearchTypeTrack, options); err == nil { + // TODO use spotify.client while still token valid, then switch to Default one + if searchResult, err := webspotify.DefaultClient.SearchOpt(query, webspotify.SearchTypeTrack, options); err == nil { numberOfTracks := len(searchResult.Tracks.Tracks) infrastructure.Debugf("Search '%v' returned %v track(s)", query, numberOfTracks) for _, track := range searchResult.Tracks.Tracks { @@ -102,13 +104,6 @@ func checkAlias(query string) string { return query } -func (spotify *Spotify) getWebApiClient() *webspotify.Client { - if spotify.client != nil { - return spotify.client - } - return webspotify.DefaultClient -} - func (spotify *Spotify) pause() { if spotify.currentTrack != nil { if spotify.paused {