示例#1
0
  /**
   * @since 2.7.0
   * @param jsonArr
   */
  private void extractFilterList(final JSONArray jsonArr) {
    final JSONArray animeListArr = jsonArr.getJSONArray(2);

    for (int i = 0; i < animeListArr.length(); i++) {
      final String thumbnail = animeListArr.getJSONObject(i).getString("thumbnail").trim();
      final String title = animeListArr.getJSONObject(i).getString("title").trim();
      final String infoLink = animeListArr.getJSONObject(i).getString("infoLink").trim();

      if (isNotBlank(title) && isNotBlank(infoLink)) {
        filterListEntries.add(new FilterEntry(title, thumbnail, infoLink));
      } else {
        log.debug("Could not import '{}', because the type is unknown.", title);
      }
    }
    persistence.addFilterList(filterListEntries);
  }
示例#2
0
  /**
   * @since 2.7.0
   * @param jsonArr
   */
  private void extractAnimeList(final JSONArray jsonArr) {
    final JSONArray animeListArr = jsonArr.getJSONArray(0);

    for (int i = 0; i < animeListArr.length(); i++) {
      final String title = animeListArr.getJSONObject(i).getString("title").trim();
      final AnimeType type =
          AnimeType.findByName(animeListArr.getJSONObject(i).getString("type").trim());
      final Integer episodes = animeListArr.getJSONObject(i).getInt("episodes");
      final String infoLink = animeListArr.getJSONObject(i).getString("infoLink").trim();
      final String location = animeListArr.getJSONObject(i).getString("location").trim();

      if (isNotBlank(title)
          && type != null
          && episodes != null
          && isNotBlank(infoLink)
          && isNotBlank(location)) {
        final Anime curAnime = new Anime(title, type, episodes, infoLink, location);
        animeListEntries.add(curAnime);
      } else {
        log.debug("Could not import '{}', because the type is unknown.", title);
      }
    }
    persistence.addAnimeList(animeListEntries);
  }