Search in sources :

Example 1 with GetIndexesResponse

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;
}
Also used : GetIndexesResponse(org.moire.ultrasonic.api.subsonic.response.GetIndexesResponse) Indexes(org.moire.ultrasonic.domain.Indexes)

Aggregations

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