Search in sources :

Example 1 with GetArtistsResponse

use of org.moire.ultrasonic.api.subsonic.response.GetArtistsResponse in project ultrasonic by ultrasonic.

the class RESTMusicService method getArtists.

@Override
public Indexes getArtists(boolean refresh, Context context, ProgressListener progressListener) throws Exception {
    Indexes cachedArtists = fileStorage.load(ARTISTS_STORAGE_NAME, DomainSerializers.getIndexesSerializer());
    if (cachedArtists != null && !refresh) {
        return cachedArtists;
    }
    updateProgressListener(progressListener, R.string.parser_reading);
    Response<GetArtistsResponse> response = subsonicAPIClient.getApi().getArtists(null).execute();
    checkResponseSuccessful(response);
    Indexes indexes = APIIndexesConverter.toDomainEntity(response.body().getIndexes());
    fileStorage.store(ARTISTS_STORAGE_NAME, indexes, DomainSerializers.getIndexesSerializer());
    return indexes;
}
Also used : Indexes(org.moire.ultrasonic.domain.Indexes) GetArtistsResponse(org.moire.ultrasonic.api.subsonic.response.GetArtistsResponse)

Aggregations

GetArtistsResponse (org.moire.ultrasonic.api.subsonic.response.GetArtistsResponse)1 Indexes (org.moire.ultrasonic.domain.Indexes)1