Examples of StringUtil


Examples of com.github.hakko.musiccabinet.util.StringUtil

        new UserRecommendedArtistsParserImpl(new ResourceUtil(
            RJ_FILE).getInputStream()).getArtists());

    String body = new WSResponse(new ResourceUtil(FTPAREA_FILE).getContent()).getResponseBody();
    ftpareaRec = new UserRecommendedArtists(ftparea,
        new UserRecommendedArtistsParserImpl(new StringUtil(
            body).getInputStream()).getArtists());

    createArtistMetaData();
  }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

  public void resourceFile2CorrectlyParsed() throws ApplicationException {
    WSResponse wsResponse = new WSResponse(new ResourceUtil(
        USER_RECOMMENDED_ARTISTS_FILE2).getContent());
   
    UserRecommendedArtistsParser parser = new UserRecommendedArtistsParserImpl(
        new StringUtil(wsResponse.getResponseBody()).getInputStream());
    List<RecommendedArtist> artists = parser.getArtists();
   
    for (int i = 0; i < EXPECTED_ARTISTS2.size(); i++) {
      assertEquals(EXPECTED_ARTISTS2.get(i), artists.get(i));
    }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

      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());
        }
      } while (++page < totalPages);
      addFinishedOperation();
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

   
    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());
        }
      } catch (ApplicationException e) {
        LOG.warn("Fetching artist relations for " + artistName + " failed.", e);
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

   
    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()));
        }
      } catch (ApplicationException e) {
        LOG.warn("Fetching top artist for " + tag.getName() + " failed.", e);
      }
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

    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());
          } else {
            LOG.warn("Artist info response for " + artistName
                + " not parsed correctly. Response was "
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

    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()));
          }
        } catch (ApplicationException e) {
          LOG.warn("Fetching top artist for " + user.getLastFmUsername()
              + ", " + period.getDescription() + " failed.", e);
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

    List<Artist> missingArtists = artistDao.getMissingArtists();
    List<MBArtist> mbArtists = new ArrayList<>();
    mbids = missingArtists.size();
    for (Artist artist : artistDao.getMissingArtists()) {
      try {
        StringUtil response = new StringUtil(artistQueryClient.get(artist.getName()));
        ArtistQueryParser parser = new ArtistQueryParserImpl(response.getInputStream());
        if (parser.getArtist() != null) {
          mbArtists.add(parser.getArtist());
          if (mbArtists.size() > 100) {
            artistDao.createArtists(mbArtists);
            mbArtists.clear();
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

    discographies = outdatedArtists.size();
    for (MBArtist artist : outdatedArtists) {
      try {
        int offset = 0;
        do {
          StringUtil response = new StringUtil(releaseClient.get(
            artist.getName(), artist.getMbid(), offset));
          parser = new ReleaseParserImpl(response.getInputStream());
          for (MBRelease album : parser.getReleases()) {
            album.setArtistId(artist.getId());
          }
          mbReleases.addAll(parser.getReleases());
          offset += 100;
View Full Code Here

Examples of com.github.hakko.musiccabinet.util.StringUtil

   
    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());
        }
      } catch (ApplicationException e) {
        LOG.warn("Fetching top tracks for " + artistName + " failed.", e);
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.