com.wrapper.spotify.exceptions.SpotifyWebApiException Java Examples
The following examples show how to use
com.wrapper.spotify.exceptions.SpotifyWebApiException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Application.java From spotify-toniebox-sync with Apache License 2.0 | 6 votes |
private static void sync(SpotifyHandler spotifyHandler, PlaylistSimplified playlist, CreativeTonie tonie) throws IOException, SpotifyWebApiException, InterruptedException { List<PlaylistTrack> allTracks = PlaylistHandler.getTracks(spotifyHandler, playlist); List<Chapter> chaptersToRemove = PlaylistUtils.determineChaptersToRemove(allTracks, tonie.getChapters()); deleteChapter(tonie, chaptersToRemove); List<PlaylistTrack> trackCacheToClean = PlaylistUtils.determineCacheFilesToRenew(tonie.getChapters(), allTracks); deleteCacheFileForTracks(spotifyHandler, trackCacheToClean); List<PlaylistTrack> tracks = PlaylistUtils.getDownloadList(allTracks, tonie.getChapters()); transferFromSpotifyToToniebox(spotifyHandler, tonie, tracks); tonie.setChapters(PlaylistUtils.getSortedChapterList(allTracks, tonie.getChapters())); tonie.commit(); }
Example #2
Source File: SpotifyHttpManager.java From spotify-web-api-java with MIT License | 6 votes |
@Override public String delete(URI uri, Header[] headers, HttpEntity body) throws IOException, SpotifyWebApiException, ParseException { assert (uri != null); assert (!uri.toString().equals("")); final HttpDelete httpDelete = new HttpDelete(uri); httpDelete.setHeaders(headers); httpDelete.setEntity(body); String responseBody = getResponseBody(execute(httpClient, httpDelete)); httpDelete.reset(); return responseBody; }
Example #3
Source File: SetRepeatModeOnUsersPlaybackExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void setRepeatModeOnUsersPlayback_Sync() { try { final String string = setRepeatModeOnUsersPlaybackRequest.execute(); System.out.println("Null: " + string); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #4
Source File: CreatePlaylistExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void createPlaylist_Sync() { try { final Playlist playlist = createPlaylistRequest.execute(); System.out.println("Name: " + playlist.getName()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #5
Source File: GetPlaylistExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getPlaylist_Sync() { try { final Playlist playlist = getPlaylistRequest.execute(); System.out.println("Name: " + playlist.getName()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #6
Source File: CheckUsersSavedAlbumsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void checkUsersSavedAlbums_Sync() { try { final Boolean[] booleans = checkUsersSavedAlbumsRequest.execute(); System.out.println("Length: " + booleans.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #7
Source File: GetUsersSavedShowsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getUsersSavedShows_Sync() { try { final Paging<SavedShow> savedShowPaging = getUsersSavedShowsRequest.execute(); System.out.println("Total: " + savedShowPaging.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #8
Source File: GetEpisodeRequest.java From spotify-web-api-java with MIT License | 5 votes |
/** * Get an episode * * @return An {@link Episode}. * @throws IOException In case of networking issues. * @throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause. */ @Override public Episode execute() throws IOException, SpotifyWebApiException, ParseException { return new Episode.JsonUtil().createModelObject(getJson()); }
Example #9
Source File: SpotifyPlayer.java From nanoleaf-desktop with MIT License | 5 votes |
private void init() { try { System.out.println("init"); initEffect(); CurrentlyPlaying current = getCurrentlyPlaying(); currentTrack = current.getItem(); currentAlbum = currentTrack.getAlbum(); currentTrackAnalysis = getTrackAnalysis(currentTrack.getId()); progress = current.getProgress_ms(); playing = true; updateTrackInfoText(); updateTrackProgressText(); // java.awt.Color[] newpalette = getAlbumImagePalette(); // setPalette(convertPalette(newpalette)); // System.out.println(Arrays.asList(newpalette)); // panel.setPalette(newpalette); } catch (SpotifyWebApiException swe) { swe.printStackTrace(); } catch (NullPointerException npe) { npe.printStackTrace(); init(); } catch (IOException ioe) { ioe.printStackTrace(); } catch (StatusCodeException sce) { sce.printStackTrace(); } }
Example #10
Source File: AddItemsToPlaylistExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void addItemsToPlaylist_Sync() { try { final SnapshotResult snapshotResult = addItemsToPlaylistRequest.execute(); System.out.println("Snapshot ID: " + snapshotResult.getSnapshotId()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #11
Source File: GetArtistsAlbumsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getArtistsAlbums_Sync() { try { final Paging<AlbumSimplified> albumSimplifiedPaging = getArtistsAlbumsRequest.execute(); System.out.println("Total: " + albumSimplifiedPaging.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #12
Source File: GetCurrentUsersProfileExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getCurrentUsersProfile_Sync() { try { final User user = getCurrentUsersProfileRequest.execute(); System.out.println("Display name: " + user.getDisplayName()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #13
Source File: GetEpisodeExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getEpisode_Sync() { try { final Episode episode = getEpisodeRequest.execute(); System.out.println("Name: " + episode.getName()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #14
Source File: SearchAlbumsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void searchAlbums_Sync() { try { final Paging<AlbumSimplified> albumSimplifiedPaging = searchAlbumsRequest.execute(); System.out.println("Total: " + albumSimplifiedPaging.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #15
Source File: GetUsersAvailableDevicesExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getUsersAvailableDevices_Sync() { try { final Device[] devices = getUsersAvailableDevicesRequest.execute(); System.out.println("Length: " + devices.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #16
Source File: GetShowsEpisodesRequest.java From spotify-web-api-java with MIT License | 5 votes |
/** * Get episodes of a show. * * @return An array of {@link EpisodeSimplified} objects wrapped in a {@link Paging} object. * @throws IOException In case of networking issues. * @throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause. */ @Override public Paging<EpisodeSimplified> execute() throws IOException, SpotifyWebApiException, ParseException { return new EpisodeSimplified.JsonUtil().createModelObjectPaging(getJson()); }
Example #17
Source File: GetSeveralShowsRequest.java From spotify-web-api-java with MIT License | 5 votes |
/** * Get several shows. * * @return Multiple {@link ShowSimplified} objects. * @throws IOException In case of networking issues. * @throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause. */ @Override public ShowSimplified[] execute() throws IOException, SpotifyWebApiException, ParseException { return new ShowSimplified.JsonUtil().createModelObjectArray(getJson(), "shows"); }
Example #18
Source File: CheckUsersSavedTracksExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void checkUsersSavedTracks_Sync() { try { final Boolean[] booleans = checkUsersSavedTracksRequest.execute(); System.out.println("Length: " + booleans.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #19
Source File: GetCurrentUsersRecentlyPlayedTracksExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getCurrentUsersRecentlyPlayedTracks_Sync() { try { final PagingCursorbased<PlayHistory> playHistoryPagingCursorbased = getCurrentUsersRecentlyPlayedTracksRequest.execute(); System.out.println("Total: " + playHistoryPagingCursorbased.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #20
Source File: AddItemToUsersPlaybackQueueExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void addItemToUsersPlaybackQueue_Sync() { try { final String string = addItemToUsersPlaybackQueueRequest.execute(); System.out.println("Null: " + string); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #21
Source File: CheckUsersSavedShowsRequest.java From spotify-web-api-java with MIT License | 5 votes |
/** * Check whether a show is present in the current user's "Your Music" library. * * @return Whether an show is present in the current user's "Your Music" library. * @throws IOException In case of networking issues. * @throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause. */ @Override public Boolean[] execute() throws IOException, SpotifyWebApiException, ParseException { return new Gson().fromJson(JsonParser.parseString(getJson()).getAsJsonArray(), Boolean[].class); }
Example #22
Source File: GetUsersTopArtistsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getUsersTopArtists_Sync() { try { final Paging<Artist> artistPaging = getUsersTopArtistsRequest.execute(); System.out.println("Total: " + artistPaging.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #23
Source File: GetAudioFeaturesForSeveralTracksExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getAudioFeaturesForSeveralTracks_Sync() { try { final AudioFeatures[] audioFeatures = getAudioFeaturesForSeveralTracksRequest.execute(); System.out.println("Length: " + audioFeatures.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #24
Source File: CheckUsersSavedShowsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void checkUsersSavedShows_Sync() { try { final Boolean[] booleans = checkUsersSavedShowsRequest.execute(); System.out.println("Length: " + booleans.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #25
Source File: GetAudioAnalysisForTrackExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getAudioAnalysisForTrack_Sync() { try { final AudioAnalysis audioAnalysis = getAudioAnalysisForTrackRequest.execute(); System.out.println("Track duration: " + audioAnalysis.getTrack().getDuration()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #26
Source File: GetAudioFeaturesForTrackExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getAudioFeaturesForTrack_Sync() { try { final AudioFeatures audioFeatures = getAudioFeaturesForTrackRequest.execute(); System.out.println("ID: " + audioFeatures.getId()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #27
Source File: GetAlbumsTracksExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getAlbumsTracks_Sync() { try { final Paging<TrackSimplified> trackSimplifiedPaging = getAlbumsTracksRequest.execute(); System.out.println("Total: " + trackSimplifiedPaging.getTotal()); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #28
Source File: UnfollowArtistsOrUsersExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void unfollowArtistsOrUsers_Sync() { try { final String string = unfollowArtistsOrUsersRequest.execute(); System.out.println("Null: " + string); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #29
Source File: CheckUsersFollowPlaylistExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void checkUsersFollowPlaylist_Sync() { try { final Boolean[] booleans = checkUsersFollowPlaylistRequest.execute(); System.out.println("Length: " + booleans.length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }
Example #30
Source File: GetRecommendationsExample.java From spotify-web-api-java with MIT License | 5 votes |
public static void getRecommendations_Sync() { try { final Recommendations recommendations = getRecommendationsRequest.execute(); System.out.println("Length: " + recommendations.getTracks().length); } catch (IOException | SpotifyWebApiException | ParseException e) { System.out.println("Error: " + e.getMessage()); } }