Package com.github.hakko.musiccabinet.domain.model.aggr

Examples of com.github.hakko.musiccabinet.domain.model.aggr.Scrobble


    }
  }
 
  private void addScrobble(Scrobble scrobble) {
    ConcurrentLinkedDeque<Scrobble> deque = userScrobbles.get(scrobble.getLastFmUser());
    Scrobble tail;
    while ((tail = deque.peekLast()) != null && tooClose(tail, scrobble)) {
      // indicates the occurrence of a previous track that was played for a few
      // seconds, and that should be removed
      deque.pollLast();
    }
View Full Code Here


    return secondsBetween(prev.getStartTime(), next).getSeconds() < allowedDiff;
  }

  protected void scrobbleTracks() throws ApplicationException {
    scrobbleFailedTracks();
    Scrobble head;
    for (LastFmUser lastFmUser : userScrobbles.keySet()) {
      ConcurrentLinkedDeque<Scrobble> deque = userScrobbles.get(lastFmUser);
      while ((head = deque.peekFirst()) != null && !tooClose(head, new DateTime())) {
        playCountDao.addPlayCount(head.getLastFmUser(), head.getTrack());
        WSResponse wsResponse = scrobbleClient.scrobble(head);
        if (!wsResponse.wasCallSuccessful()) {
          LOG.warn("scrobbling " + head + " failed! Add for re-sending.");
          LOG.debug("Scrobble response: " + wsResponse);
          failedScrobbles.add(head);
View Full Code Here

  }

  protected void scrobbleFailedTracks() throws ApplicationException {
    while (failedScrobbles.size() > 0) {
      LOG.debug("Queue of failed scrobbles consists of " + failedScrobbles.size() + " elements.");
      Scrobble firstFailed = failedScrobbles.get(0);
      WSResponse wsResponse = scrobbleClient.scrobble(firstFailed);
      if (wsResponse.wasCallSuccessful()) {
        LOG.debug("Failed scrobble was re-sent.");
        failedScrobbles.remove(0);
      } else {
View Full Code Here

TOP

Related Classes of com.github.hakko.musiccabinet.domain.model.aggr.Scrobble

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.