Examples of wasCallSuccessful()


Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

    for (LastFmUser user : users) {
      short page = 0, totalPages = 0;
      List<Track> lovedTracks = new ArrayList<>();
      do {
        WSResponse wsResponse = userLovedTracksClient.getUserLovedTracks(user, page);
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          UserLovedTracksParser parser = new UserLovedTracksParserImpl(
              stringUtil.getInputStream());
          totalPages = parser.getTotalPages();
          lovedTracks.addAll(parser.getLovedTracks());
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

    setTotalOperations(artistNames.size());
   
    for (String artistName : artistNames) {
      try {
        WSResponse wsResponse = artistSimilarityClient.getArtistSimilarity(new Artist(artistName));
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          ArtistSimilarityParser asParser =
            new ArtistSimilarityParserImpl(stringUtil.getInputStream());
          artistRelationDao.createArtistRelations(asParser.getArtist(),
              asParser.getArtistRelations());
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

    setTotalOperations(tags.size());
   
    for (Tag tag : tags) {
      try {
        WSResponse wsResponse = tagTopArtistsClient.getTopArtists(tag);
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          TagTopArtistsParser parser =
              new TagTopArtistsParserImpl(stringUtil.getInputStream());
          topArtists.add(new TagTopArtists(tag.getName(), parser.getArtists()));
        }
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

            scrobble.getTrack().getId() == previous.getTrack().getId()) {
            LOG.debug("Same track was scrobbled just recently, ignore.");
          } else {
            addScrobble(scrobble);
            WSResponse wsResponse = client.updateNowPlaying(message.getPayload());
            LOG.debug("Successful: " + wsResponse.wasCallSuccessful());
            LOG.debug("Response: " + wsResponse.getResponseBody());
          }
        } catch (ApplicationException e) {
          LOG.warn("Could not update now playing at last.fm.", e);
        }
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

   
    for (String artistName : artistNames) {
      try {
        WSResponse wsResponse = artistInfoClient.getArtistInfo(
            new Artist(artistName), lastFmSettingsService.getLang());
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          ArtistInfoParser aiParser =
            new ArtistInfoParserImpl(stringUtil.getInputStream());
          if (aiParser.getArtistInfo() != null) {
            artistInfos.add(aiParser.getArtistInfo());
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

   
    for (LastFmUser user : users) {
      for (Period period : Period.values()) {
        try {
          WSResponse wsResponse = userTopArtistsClient.getUserTopArtists(user, period);
          if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
            StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
            UserTopArtistsParser parser =
                new UserTopArtistsParserImpl(stringUtil.getInputStream());
            userTopArtists.add(new UserTopArtists(user, period, parser.getArtists()));
          }
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

          scrobble.getTrack().getId() == previous.getTrack().getId()) {
        LOG.debug("Same track was scrobbled just recently, ignore.");
      } else {
        addScrobble(scrobble);
        WSResponse wsResponse = nowPlayingClient.updateNowPlaying(scrobble);
        if (!wsResponse.wasCallSuccessful()) {
          LOG.debug("Could not update now playing status at last.fm.");
          LOG.debug("Nowplaying response: " + wsResponse);
        }
      }
    }
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

    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);
        }
        deque.pollFirst();
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

  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 {
        LOG.debug("Failed scrobble could not be re-sent. Wait a minute before trying again.");
        LOG.debug("Response: " + wsResponse);
View Full Code Here

Examples of com.github.hakko.musiccabinet.ws.lastfm.WSResponse.wasCallSuccessful()

    setTotalOperations(artistNames.size());
   
    for (String artistName : artistNames) {
      try {
        WSResponse wsResponse = artistTopTracksClient.getTopTracks(new Artist(artistName));
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          ArtistTopTracksParser attParser =
            new ArtistTopTracksParserImpl(stringUtil.getInputStream());
          artistTopTracksDao.createTopTracks(attParser.getArtist(),
              attParser.getTopTracks());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.