Package com.github.hakko.musiccabinet.parser.lastfm

Examples of com.github.hakko.musiccabinet.parser.lastfm.UserTopArtistsParserImpl


  private void createArtistInfosAndLocalFiles() throws ApplicationException {
    Map<Artist, ArtistInfo> artistInfos = new HashMap<>();
    List<File> files = new ArrayList<>();
    for (Period period : Period.values()) {
      String fileName = format(TOP_ARTISTS_FILE, period.getDescription());
      for (Artist artist : new UserTopArtistsParserImpl(
          new ResourceUtil(fileName, UTF8).getInputStream()).getArtists()) {
        artistInfos.put(artist, new ArtistInfo(artist));
        files.add(UnittestLibraryUtil.getFile(artist.getName(), "A", "T"));
      }
    }
View Full Code Here


  @Before
  public void loadFunctionDependency() throws ApplicationException {
    PostgreSQLUtil.loadFunction(dao, UPDATE_USER_TOP_ARTISTS);

    arnOverall = new UserTopArtists(arn, Period.OVERALL,
        new UserTopArtistsParserImpl(new ResourceUtil(
            ARN_OVERALL_FILE).getInputStream()).getArtists());
    arn6month = new UserTopArtists(arn, Period.SIX_MONTHS,
        new UserTopArtistsParserImpl(new ResourceUtil(
            ARN_6MONTH_FILE).getInputStream()).getArtists());
    sys3month = new UserTopArtists(sys, Period.THREE_MONTHS,
        new UserTopArtistsParserImpl(new ResourceUtil(
            SYS_3MONTH_FILE).getInputStream()).getArtists());

    createArtistMetaData();
  }
View Full Code Here

        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

TOP

Related Classes of com.github.hakko.musiccabinet.parser.lastfm.UserTopArtistsParserImpl

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.