src/main/java/org/intellimate/izou/sdk/frameworks/music/user/PlaylistSelector.java
public Optional<Playlist> getPlaylist(String playlistName) {
        try {
            return context.getResources().generateResource(BroadcasterPlaylist.createPlaylistRequest(player, playlistName))
                    .orElse(CompletableFuture.completedFuture(new ArrayList<>()))
                    .thenApply(list -> list.stream()
                            .filter(resourceModel -> resourceModel.getProvider().equals(player))
                            .findAny()
                            .flatMap(Playlist::importResource)
                    ).get(1, TimeUnit.SECONDS);
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            context.getLogger().error("unable to get Playlist");
            return Optional.empty();
        }
    }
public Optional<Playlist> getPlaylist(String playlistName) {
        try {
            return context.getResources().generateResource(BroadcasterPlaylist.createPlaylistRequest(player, playlistName))
                    .orElse(CompletableFuture.completedFuture(new ArrayList<>()))
                    .thenApply(list -> list.stream()
                            .filter(resourceModel -> resourceModel.getProvider().equals(player))
                            .findAny()
                            .flatMap(Playlist::importResource)
                    ).get(1, TimeUnit.SECONDS);
        } catch (InterruptedException | ExecutionException | TimeoutException e) {
            context.getLogger().error("unable to get Playlist");
            return Optional.empty();
        }
    }
public Optional < Playlist > getPlaylist ( String playlistName ) { try { return context . getResources ( ) . generateResource ( BroadcasterPlaylist . createPlaylistRequest ( player , playlistName ) ) . orElse ( CompletableFuture . completedFuture ( new ArrayList <> ( ) ) ) . thenApply ( list -> list . stream ( ) . filter ( resourceModel -> resourceModel . getProvider ( ) . equals ( player ) ) . findAny ( ) . flatMap ( Playlist :: importResource ) ) . get ( 1 , TimeUnit . SECONDS ) ; } catch ( InterruptedException | ExecutionException | TimeoutException e ) { context . getLogger ( ) . error ( "unable to get Playlist" ) ; return Optional . empty ( ) ; } }
asks the Player for more information about the playlist.
<p>
This method may block for 1 second.
@param playlistName the name of the playlist
@return an optional answer of the player
asks the Player for more information about the playlist . <p > This method may block for 1 second .