diff options
Diffstat (limited to 'net/sync')
2 files changed, 0 insertions, 147 deletions
diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java index 7c0d7cb51..37fb5f76f 100644 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java +++ b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/GpodnetService.java @@ -26,7 +26,6 @@ import de.danoeh.antennapod.net.sync.gpoddernet.mapper.ResponseMapper; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetDevice; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetEpisodeActionPostResponse; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetTag; import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetUploadChangesResponse; import de.danoeh.antennapod.net.sync.model.EpisodeAction; import de.danoeh.antennapod.net.sync.model.EpisodeActionChanges; @@ -80,86 +79,6 @@ public class GpodnetService implements ISyncService { } /** - * Returns the [count] most used tags. - */ - public List<GpodnetTag> getTopTags(int count) throws GpodnetServiceException { - URL url; - try { - url = new URI(baseScheme, null, baseHost, basePort, - String.format(Locale.US, "/api/2/tags/%d.json", count), null, null).toURL(); - } catch (MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - - Request.Builder request = new Request.Builder().url(url); - String response = executeRequest(request); - try { - JSONArray jsonTagList = new JSONArray(response); - List<GpodnetTag> tagList = new ArrayList<>(jsonTagList.length()); - for (int i = 0; i < jsonTagList.length(); i++) { - JSONObject jsonObject = jsonTagList.getJSONObject(i); - String title = jsonObject.getString("title"); - String tag = jsonObject.getString("tag"); - int usage = jsonObject.getInt("usage"); - tagList.add(new GpodnetTag(title, tag, usage)); - } - return tagList; - } catch (JSONException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** - * Returns the [count] most subscribed podcasts for the given tag. - * - * @throws IllegalArgumentException if tag is null - */ - public List<GpodnetPodcast> getPodcastsForTag(@NonNull GpodnetTag tag, int count) - throws GpodnetServiceException { - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format(Locale.US, "/api/2/tag/%s/%d.json", tag.getTag(), count), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - String response = executeRequest(request); - - JSONArray jsonArray = new JSONArray(response); - return readPodcastListFromJsonArray(jsonArray); - - } catch (JSONException | MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** - * Returns the toplist of podcast. - * - * @param count of elements that should be returned. Must be in range 1..100. - * @throws IllegalArgumentException if count is out of range. - */ - public List<GpodnetPodcast> getPodcastToplist(int count) throws GpodnetServiceException { - if (count < 1 || count > 100) { - throw new IllegalArgumentException("Count must be in range 1..100"); - } - - try { - URL url = new URI(baseScheme, null, baseHost, basePort, - String.format(Locale.US, "/toplist/%d.json", count), null, null).toURL(); - Request.Builder request = new Request.Builder().url(url); - String response = executeRequest(request); - - JSONArray jsonArray = new JSONArray(response); - return readPodcastListFromJsonArray(jsonArray); - - } catch (JSONException | MalformedURLException | URISyntaxException e) { - e.printStackTrace(); - throw new GpodnetServiceException(e); - } - } - - /** * Searches the podcast directory for a given string. * * @param query The search query diff --git a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetTag.java b/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetTag.java deleted file mode 100644 index d3d683598..000000000 --- a/net/sync/gpoddernet/src/main/java/de/danoeh/antennapod/net/sync/gpoddernet/model/GpodnetTag.java +++ /dev/null @@ -1,66 +0,0 @@ -package de.danoeh.antennapod.net.sync.gpoddernet.model; - -import android.os.Parcel; -import android.os.Parcelable; -import androidx.annotation.NonNull; - -public class GpodnetTag implements Parcelable { - - private final String title; - private final String tag; - private final int usage; - - public GpodnetTag(@NonNull String title, @NonNull String tag, int usage) { - this.title = title; - this.tag = tag; - this.usage = usage; - } - - private GpodnetTag(Parcel in) { - title = in.readString(); - tag = in.readString(); - usage = in.readInt(); - } - - @Override - public String toString() { - return "GpodnetTag [title="+title+", tag=" + tag + ", usage=" + usage + "]"; - } - - public String getTitle() { - return title; - } - - public String getTag() { - return tag; - } - - public int getUsage() { - return usage; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeString(title); - dest.writeString(tag); - dest.writeInt(usage); - } - - public static final Creator<GpodnetTag> CREATOR = new Creator<GpodnetTag>() { - @Override - public GpodnetTag createFromParcel(Parcel in) { - return new GpodnetTag(in); - } - - @Override - public GpodnetTag[] newArray(int size) { - return new GpodnetTag[size]; - } - }; - -} |