예제 #1
0
  public boolean showSetQuality(
      String tvdbid, EnumSet<Show.Quality> initial, EnumSet<Show.Quality> archive)
      throws Exception {
    StringBuilder builder = new StringBuilder("show.setquality");
    builder.append("&tvdbid=");
    builder.append(tvdbid);
    if (initial != null) {
      builder.append("&initial=");
      Iterator<Quality> iter = initial.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }
    if (archive != null) {
      builder.append("&archive=");
      Iterator<Quality> iter = archive.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }

    return this.<Object>commandSuccessful(
        builder.toString(), new TypeToken<JsonResponse<Object>>() {}.getType());
  }
예제 #2
0
  public boolean showAddNew(
      String tvdbid,
      Language language,
      Boolean seasonFolders,
      Status status,
      EnumSet<Show.Quality> initial,
      EnumSet<Quality> archive)
      throws Exception {
    StringBuilder builder = new StringBuilder("show.addnew");
    builder.append("&tvdbid=");
    builder.append(tvdbid);
    if (language != null) {
      builder.append("&lang=");
      builder.append(language.getAbbrev());
    }
    if (seasonFolders != null) {
      // the option isnt called season folders anymore
      if (apiVersion >= 3) {
        builder.append("&flatten_folders=");
      } else {
        builder.append("&season_folder=");
      }
      // if you pass me a boolean you better damn well have checked the version number
      builder.append(seasonFolders ? "1" : "0");
    }
    if (status != null) {
      builder.append("&status=");
      builder.append(status.toJson());
    }
    if (initial != null) {
      builder.append("&initial=");
      Iterator<Quality> iter = initial.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }
    if (archive != null) {
      builder.append("&archive=");
      Iterator<Show.Quality> iter = archive.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }

    return this.<Object>commandSuccessful(
        builder.toString(), new TypeToken<JsonResponse<Object>>() {}.getType());
  }
예제 #3
0
  public List<eROMImpact> getImpacts() {
    ArrayList<eROMImpact> list = new ArrayList<eROMImpact>();
    Iterator<eROMImpact> iIt = reImpacts.iterator();
    while (iIt.hasNext()) list.add(iIt.next());

    return list;
  }
예제 #4
0
 /**
  * Helper method that can be used to dynamically figure out enumeration type of given {@link
  * EnumSet}, without having access to its declaration. Code is needed to work around design flaw
  * in JDK.
  *
  * @since 1.5
  */
 public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) {
   // First things first: if not empty, easy to determine
   if (!s.isEmpty()) {
     return findEnumType(s.iterator().next());
   }
   // Otherwise need to locate using an internal field
   return EnumTypeLocator.instance.enumTypeFor(s);
 }