All Downloads are FREE. Search and download functionalities are using the official Maven repository.

angry1980.audio.similarity.TracksToCalculateImpl Maven / Gradle / Ivy

There is a newer version: 0.0.10
Show newest version
package angry1980.audio.similarity;

import angry1980.audio.dao.TrackDAO;
import angry1980.audio.model.Track;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rx.Observable;

import java.util.Objects;

public class TracksToCalculateImpl implements TracksToCalculate {

    private static Logger LOG = LoggerFactory.getLogger(TracksToCalculateImpl.class);

    private TrackDAO trackDAO;

    public TracksToCalculateImpl(TrackDAO trackDAO) {
        this.trackDAO = Objects.requireNonNull(trackDAO);
    }

    @Override
    public Observable get() {
        return Observable.create(subscriber -> {
            trackDAO.getAllOrEmpty().stream()
                    .peek(track -> LOG.info("{} is ready for similarity calculation", track))
                    .forEach(subscriber::onNext);
            subscriber.onCompleted();
        })
        ;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy