Examples of StringUtil


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

      try {
        WSResponse wsResponse = userRecommendedArtistsClient.
            getUserRecommendedArtists(user.getLastFmUsername());
        LOG.debug(wsResponse);
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          UserRecommendedArtistsParser parser =
              new UserRecommendedArtistsParserImpl(stringUtil.getInputStream());
          artists.add(new UserRecommendedArtists(user, parser.getArtists()));
        }
      } catch (ApplicationException e) {
        LOG.warn("Fetching top artist for " + user.getLastFmUsername() + " failed.", e);
      }
View Full Code Here

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

   
    for (LastFmGroup group : groups) {
      try {
        WSResponse wsResponse = client.getWeeklyArtistChart(group);
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          GroupWeeklyArtistChartParser parser =
              new GroupWeeklyArtistChartParserImpl(stringUtil.getInputStream());
          artistCharts.add(new GroupWeeklyArtistChart(
              group.getName(), parser.getArtistPlayCount()));
        }
      } catch (ApplicationException e) {
        LOG.warn("Fetching weekly artist chart for " + group.getName() + " failed.", e);
View Full Code Here

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

   
    for (Album album : albums) {
      try {
        WSResponse wsResponse = albumInfoClient.getAlbumInfo(album);
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          AlbumInfoParser aiParser =
            new AlbumInfoParserImpl(stringUtil.getInputStream());
          albumInfos.add(aiParser.getAlbumInfo());
         
          if (albumInfos.size() == BATCH_SIZE) {
            albumInfoDao.createAlbumInfo(albumInfos);
            albumInfos.clear();
View Full Code Here

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

   
    for (String artistName : artistNames) {
      try {
        WSResponse wsResponse = artistTopTagsClient.getTopTags(new Artist(artistName));
        if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
          StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
          ArtistTopTagsParser attParser =
            new ArtistTopTagsParserImpl(stringUtil.getInputStream());
          removeTagsWithLowTagCount(attParser.getTopTags());
          artistTopTagsDao.createTopTags(attParser.getArtist(),
              attParser.getTopTags());
        }
      } catch (ApplicationException e) {
View Full Code Here

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

    short page = 0, totalPages = 0;
    do {
      WSResponse wsResponse = client.getLibraryTracks(page,
          lastFmSettingsService.getLastFmUsername());
      if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
        StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
        ScrobbledTracksParser parser = new ScrobbledTracksParserImpl(
            stringUtil.getInputStream());
        totalPages = parser.getTotalPages();
        trackPlayCountDao.createTrackPlayCounts(parser.getTrackPlayCounts());
        setTotalOperations(totalPages);
        addFinishedOperation();
      }
View Full Code Here

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

    setTotalOperations(tags.size());
   
    for (String tag : tags) {
      WSResponse wsResponse = tagInfoClient.getTagInfo(tag, lastFmSettingsService.getLang());
      if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
        StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
        TagInfoParser tiParser = new TagInfoParserImpl(stringUtil.getInputStream());
        tagInfos.add(tiParser.getTagInfo());
      }
      addFinishedOperation();
    }
    tagInfoDao.createTagInfo(tagInfos);
View Full Code Here

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

  public LastFmUser identifyLastFmUser(String token) throws ApplicationException {
    LOG.debug("identifyLastFmUser(" + token + ")");
    WSResponse wsResponse = authSessionClient.getAuthSession(token);
    if (wsResponse.wasCallAllowed() && wsResponse.wasCallSuccessful()) {
      StringUtil stringUtil = new StringUtil(wsResponse.getResponseBody());
      AuthSessionParser authSessionParser =
          new AuthSessionParserImpl(stringUtil.getInputStream());
      return authSessionParser.getLastFmUser();
    } else {
      LOG.debug("wsResponse: " + wsResponse.getResponseBody());
      throw new ApplicationException("Could not get session key for user! (code "
          + wsResponse.getErrorCode() + ", " + wsResponse.getErrorMessage() + ")");
View Full Code Here

Examples of nav.util.string.StringUtil

     * @since 1.0
     */
    public String toStringDegMin() {
        String str = "";
        String quad = "";
        StringUtil su = new StringUtil();
        switch (coordinate) {
            case LAT:
                if (decCoordinate >= 0) {
                    quad = "N";
                } else {
                    quad = "S";
                }
                str = su.padNumZero(Math.abs(deg), 2);
                str += "\u00b0" + su.padNumZero(Math.abs(minsDecMins), 2, MINPRECISION) + "'" + quad;
                break;
            case LNG:
                if (decCoordinate >= 0) {
                    quad = "E";
                } else {
                    quad = "W";
                }
                str = su.padNumZero(Math.abs(deg), 3);
                str += "\u00b0" + su.padNumZero(Math.abs(minsDecMins), 2, MINPRECISION) + "'" + quad;
        }
        return str;
    }
View Full Code Here

Examples of nav.util.string.StringUtil

     *
     * @return              The coordinate in decimal format.
     * @since 1.0
     */
    public String toStringDec() {
        StringUtil u = new StringUtil();
        switch (coordinate) {
            case LAT:
                return u.padNumZero(decCoordinate, 2, DEGPRECISION);
            case LNG:
                return u.padNumZero(decCoordinate, 3, DEGPRECISION);
        }
        return "error";
    }
View Full Code Here

Examples of nav.util.string.StringUtil

     * @return heading      The target's heading.
     * @since 1.0
     */
    public String decodeHdg(int input) {
        String output = "";
        StringUtil u = new StringUtil();

        if (input == 511) {
            output = "n/a";
        } else {
            output = String.valueOf(u.padNumZero(input, 3));
        }

        return output;
    }
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.