Search in sources :

Example 1 with PlaylistsResponse

use of com.zype.fire.api.Model.PlaylistsResponse in project zype-firebuilder by zype.

the class ZypeApi method getPlaylists.

public PlaylistsResponse getPlaylists(int page) {
    try {
        HashMap<String, String> params = new HashMap<>();
        params.put(APP_KEY, ZypeSettings.APP_KEY);
        params.put(PER_PAGE, String.valueOf(300));
        Response response = apiImpl.getPlaylists(page, params).execute();
        if (response.isSuccessful()) {
            return (PlaylistsResponse) response.body();
        } else {
            return null;
        }
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
}
Also used : Response(retrofit2.Response) VideoFavoritesResponse(com.zype.fire.api.Model.VideoFavoritesResponse) ChannelResponse(com.zype.fire.api.Model.ChannelResponse) DevicePinResponse(com.zype.fire.api.Model.DevicePinResponse) VideosResponse(com.zype.fire.api.Model.VideosResponse) AppResponse(com.zype.fire.api.Model.AppResponse) VideoResponse(com.zype.fire.api.Model.VideoResponse) VideoEntitlementsResponse(com.zype.fire.api.Model.VideoEntitlementsResponse) PlaylistsResponse(com.zype.fire.api.Model.PlaylistsResponse) ProgramResponse(com.zype.fire.api.Model.ProgramResponse) AccessTokenResponse(com.zype.fire.api.Model.AccessTokenResponse) ZobjectContentResponse(com.zype.fire.api.Model.ZobjectContentResponse) PlanResponse(com.zype.fire.api.Model.PlanResponse) PlaylistResponse(com.zype.fire.api.Model.PlaylistResponse) AccessTokenInfoResponse(com.zype.fire.api.Model.AccessTokenInfoResponse) ZobjectTopPlaylistResponse(com.zype.fire.api.Model.ZobjectTopPlaylistResponse) ConsumerResponse(com.zype.fire.api.Model.ConsumerResponse) HashMap(java.util.HashMap) IOException(java.io.IOException) PlaylistsResponse(com.zype.fire.api.Model.PlaylistsResponse)

Example 2 with PlaylistsResponse

use of com.zype.fire.api.Model.PlaylistsResponse in project zype-firebuilder by zype.

the class ZypeDataDownloader method loadPlaylists.

private List<PlaylistData> loadPlaylists() {
    List<PlaylistData> result = new ArrayList<>();
    int page = 1;
    PlaylistsResponse playlistsResponse = ZypeApi.getInstance().getPlaylists(page);
    if (playlistsResponse != null && playlistsResponse.response != null) {
        result.addAll(playlistsResponse.response);
        if (playlistsResponse.pagination != null && playlistsResponse.pagination.pages > 1) {
            for (page = playlistsResponse.pagination.next; page <= playlistsResponse.pagination.pages; page++) {
                playlistsResponse = ZypeApi.getInstance().getPlaylists(page);
                if (playlistsResponse != null && playlistsResponse.response != null) {
                    result.addAll(playlistsResponse.response);
                }
            }
        }
    }
    return result;
}
Also used : PlaylistData(com.zype.fire.api.Model.PlaylistData) ArrayList(java.util.ArrayList) PlaylistsResponse(com.zype.fire.api.Model.PlaylistsResponse)

Aggregations

PlaylistsResponse (com.zype.fire.api.Model.PlaylistsResponse)2 AccessTokenInfoResponse (com.zype.fire.api.Model.AccessTokenInfoResponse)1 AccessTokenResponse (com.zype.fire.api.Model.AccessTokenResponse)1 AppResponse (com.zype.fire.api.Model.AppResponse)1 ChannelResponse (com.zype.fire.api.Model.ChannelResponse)1 ConsumerResponse (com.zype.fire.api.Model.ConsumerResponse)1 DevicePinResponse (com.zype.fire.api.Model.DevicePinResponse)1 PlanResponse (com.zype.fire.api.Model.PlanResponse)1 PlaylistData (com.zype.fire.api.Model.PlaylistData)1 PlaylistResponse (com.zype.fire.api.Model.PlaylistResponse)1 ProgramResponse (com.zype.fire.api.Model.ProgramResponse)1 VideoEntitlementsResponse (com.zype.fire.api.Model.VideoEntitlementsResponse)1 VideoFavoritesResponse (com.zype.fire.api.Model.VideoFavoritesResponse)1 VideoResponse (com.zype.fire.api.Model.VideoResponse)1 VideosResponse (com.zype.fire.api.Model.VideosResponse)1 ZobjectContentResponse (com.zype.fire.api.Model.ZobjectContentResponse)1 ZobjectTopPlaylistResponse (com.zype.fire.api.Model.ZobjectTopPlaylistResponse)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1