Search in sources :

Example 1 with SpotifyWebApiException

use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.

the class GetCurrentUsersProfileExample method getCurrentUsersProfile_Sync.

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());
    }
}
Also used : User(se.michaelthelin.spotify.model_objects.specification.User) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 2 with SpotifyWebApiException

use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.

the class GetPlaylistExample method getPlaylist_Sync.

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());
    }
}
Also used : Playlist(se.michaelthelin.spotify.model_objects.specification.Playlist) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 3 with SpotifyWebApiException

use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.

the class RemoveItemsFromPlaylistExample method removeItemsFromPlaylist_Sync.

public static void removeItemsFromPlaylist_Sync() {
    try {
        final SnapshotResult snapshotResult = removeItemsFromPlaylistRequest.execute();
        System.out.println("Snapshot ID: " + snapshotResult.getSnapshotId());
    } catch (IOException | SpotifyWebApiException | ParseException e) {
        System.out.println("Error: " + e.getMessage());
    }
}
Also used : SnapshotResult(se.michaelthelin.spotify.model_objects.special.SnapshotResult) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 4 with SpotifyWebApiException

use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.

the class SearchItemExample method searchItem_Sync.

public static void searchItem_Sync() {
    try {
        final SearchResult searchResult = searchItemRequest.execute();
        System.out.println("Total tracks: " + searchResult.getTracks().getTotal());
    } catch (IOException | SpotifyWebApiException | ParseException e) {
        System.out.println("Error: " + e.getMessage());
    }
}
Also used : SearchResult(se.michaelthelin.spotify.model_objects.special.SearchResult) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Example 5 with SpotifyWebApiException

use of se.michaelthelin.spotify.exceptions.SpotifyWebApiException in project spotify-web-api-java by spotify-web-api-java.

the class GetAudioAnalysisForTrackExample method getAudioAnalysisForTrack_Sync.

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());
    }
}
Also used : AudioAnalysis(se.michaelthelin.spotify.model_objects.miscellaneous.AudioAnalysis) IOException(java.io.IOException) ParseException(org.apache.hc.core5.http.ParseException) SpotifyWebApiException(se.michaelthelin.spotify.exceptions.SpotifyWebApiException)

Aggregations

IOException (java.io.IOException)33 ParseException (org.apache.hc.core5.http.ParseException)33 SpotifyWebApiException (se.michaelthelin.spotify.exceptions.SpotifyWebApiException)33 AuthorizationCodeCredentials (se.michaelthelin.spotify.model_objects.credentials.AuthorizationCodeCredentials)5 Playlist (se.michaelthelin.spotify.model_objects.specification.Playlist)4 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)3 ClientCredentials (se.michaelthelin.spotify.model_objects.credentials.ClientCredentials)3 SnapshotResult (se.michaelthelin.spotify.model_objects.special.SnapshotResult)3 Episode (se.michaelthelin.spotify.model_objects.specification.Episode)3 AudioLoadResultHandler (com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler)2 FriendlyException (com.sedmelluq.discord.lavaplayer.tools.FriendlyException)2 AudioPlaylist (com.sedmelluq.discord.lavaplayer.track.AudioPlaylist)2 Matcher (java.util.regex.Matcher)2 GuildMusicManager (me.fero.ascent.lavaplayer.GuildMusicManager)2 IPlaylistItem (se.michaelthelin.spotify.model_objects.IPlaylistItem)2 Artist (se.michaelthelin.spotify.model_objects.specification.Artist)2 PlaylistTrack (se.michaelthelin.spotify.model_objects.specification.PlaylistTrack)2 Track (se.michaelthelin.spotify.model_objects.specification.Track)2 Lists (com.google.common.collect.Lists)1 CountryCode (com.neovisionaries.i18n.CountryCode)1