use of org.moire.ultrasonic.api.subsonic.response.GetIndexesResponse in project ultrasonic by ultrasonic.
the class RESTMusicService method getIndexes.
@Override
public Indexes getIndexes(String musicFolderId, boolean refresh, Context context, ProgressListener progressListener) throws Exception {
Indexes cachedIndexes = fileStorage.load(INDEXES_STORAGE_NAME, DomainSerializers.getIndexesSerializer());
if (cachedIndexes != null && !refresh) {
return cachedIndexes;
}
updateProgressListener(progressListener, R.string.parser_reading);
Response<GetIndexesResponse> response = subsonicAPIClient.getApi().getIndexes(musicFolderId, null).execute();
checkResponseSuccessful(response);
Indexes indexes = APIIndexesConverter.toDomainEntity(response.body().getIndexes());
fileStorage.store(INDEXES_STORAGE_NAME, indexes, DomainSerializers.getIndexesSerializer());
return indexes;
}
Aggregations