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()); }
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()); }