use of org.gateshipone.malp.application.artworkdatabase.network.responses.AlbumImageResponse in project malp by gateship-one.
the class ArtworkManager method fetchVolleyError.
/**
* Called if a volley error occurs during internet communication.
*
* @param album {@link MPDAlbum} the error occured for.
* @param error {@link VolleyError} that was emitted
*/
public void fetchVolleyError(MPDAlbum album, VolleyError error) {
Log.e(TAG, "VolleyError for album: " + album.getName() + "-" + album.getArtistName());
if (error != null) {
NetworkResponse networkResponse = error.networkResponse;
/**
* Rate limit probably reached. Discontinue downloading to prevent
* ban on the servers.
*/
if (networkResponse != null && networkResponse.statusCode == 503) {
mAlbumList.clear();
cancelAllRequests();
boolean isEmpty;
synchronized (mArtistList) {
isEmpty = mArtistList.isEmpty();
}
if (isEmpty && mBulkProgressCallback != null) {
mBulkProgressCallback.finishedLoading();
}
return;
}
}
AlbumImageResponse imageResponse = new AlbumImageResponse();
imageResponse.album = album;
imageResponse.image = null;
imageResponse.url = null;
new InsertAlbumImageTask().execute(imageResponse);
}
use of org.gateshipone.malp.application.artworkdatabase.network.responses.AlbumImageResponse in project malp by gateship-one.
the class AlbumImageByteRequest method parseNetworkResponse.
@Override
protected Response<AlbumImageResponse> parseNetworkResponse(NetworkResponse response) {
AlbumImageResponse imageResponse = new AlbumImageResponse();
imageResponse.album = mAlbum;
imageResponse.image = response.data;
imageResponse.url = mUrl;
return Response.success(imageResponse, null);
}
use of org.gateshipone.malp.application.artworkdatabase.network.responses.AlbumImageResponse in project malp by gateship-one.
the class ArtworkManager method fetchJSONException.
/**
* Interface implementation to handle errors during fetching of album images
*
* @param album Album that resulted in a fetch error
*/
public void fetchJSONException(MPDAlbum album, JSONException exception) {
Log.e(TAG, "Error fetching album: " + album.getName() + "-" + album.getArtistName());
AlbumImageResponse imageResponse = new AlbumImageResponse();
imageResponse.album = album;
imageResponse.image = null;
imageResponse.url = null;
new InsertAlbumImageTask().execute(imageResponse);
}
Aggregations