From 4e47691e70e85736c7eeb30ce02c73176e565a86 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sun, 31 Mar 2024 09:15:53 +0200 Subject: Remove gpodder search (#7047) The search results are usually broken anyway or the server just returns an error 500 --- .../net/discovery/GpodnetPodcastSearcher.java | 52 ---------------------- .../net/discovery/PodcastSearchResult.java | 8 ---- .../net/discovery/PodcastSearcherRegistry.java | 1 - 3 files changed, 61 deletions(-) delete mode 100644 net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/GpodnetPodcastSearcher.java (limited to 'net/discovery/src/main/java/de/danoeh/antennapod') diff --git a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/GpodnetPodcastSearcher.java b/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/GpodnetPodcastSearcher.java deleted file mode 100644 index 270aa7a0e..000000000 --- a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/GpodnetPodcastSearcher.java +++ /dev/null @@ -1,52 +0,0 @@ -package de.danoeh.antennapod.net.discovery; - -import de.danoeh.antennapod.net.common.AntennapodHttpClient; -import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetService; -import de.danoeh.antennapod.net.sync.gpoddernet.GpodnetServiceException; -import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast; -import de.danoeh.antennapod.storage.preferences.SynchronizationCredentials; -import io.reactivex.Single; -import io.reactivex.SingleOnSubscribe; -import io.reactivex.android.schedulers.AndroidSchedulers; -import io.reactivex.schedulers.Schedulers; - -import java.util.ArrayList; -import java.util.List; - -public class GpodnetPodcastSearcher implements PodcastSearcher { - public Single> search(String query) { - return Single.create((SingleOnSubscribe>) subscriber -> { - try { - GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(), - SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceId(), - SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword()); - List gpodnetPodcasts = service.searchPodcasts(query, 0); - List results = new ArrayList<>(); - for (GpodnetPodcast podcast : gpodnetPodcasts) { - results.add(PodcastSearchResult.fromGpodder(podcast)); - } - subscriber.onSuccess(results); - } catch (GpodnetServiceException e) { - e.printStackTrace(); - subscriber.onError(e); - } - }) - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()); - } - - @Override - public Single lookupUrl(String url) { - return Single.just(url); - } - - @Override - public boolean urlNeedsLookup(String url) { - return false; - } - - @Override - public String getName() { - return "Gpodder.net"; - } -} diff --git a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearchResult.java b/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearchResult.java index b3f352334..db33d2ce7 100644 --- a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearchResult.java +++ b/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearchResult.java @@ -1,7 +1,6 @@ package de.danoeh.antennapod.net.discovery; import androidx.annotation.Nullable; -import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast; import de.mfietz.fyydlin.SearchHit; import org.json.JSONArray; import org.json.JSONException; @@ -93,13 +92,6 @@ public class PodcastSearchResult { searchHit.getAuthor()); } - public static PodcastSearchResult fromGpodder(GpodnetPodcast searchHit) { - return new PodcastSearchResult(searchHit.getTitle(), - searchHit.getLogoUrl(), - searchHit.getUrl(), - searchHit.getAuthor()); - } - public static PodcastSearchResult fromPodcastIndex(JSONObject json) { String title = json.optString("title", ""); String imageUrl = json.optString("image", null); diff --git a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearcherRegistry.java b/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearcherRegistry.java index c7892bd09..2d8c2ae38 100644 --- a/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearcherRegistry.java +++ b/net/discovery/src/main/java/de/danoeh/antennapod/net/discovery/PodcastSearcherRegistry.java @@ -15,7 +15,6 @@ public class PodcastSearcherRegistry { if (searchProviders == null) { searchProviders = new ArrayList<>(); searchProviders.add(new SearcherInfo(new CombinedSearcher(), 1.0f)); - searchProviders.add(new SearcherInfo(new GpodnetPodcastSearcher(), 0.0f)); searchProviders.add(new SearcherInfo(new FyydPodcastSearcher(), 1.0f)); searchProviders.add(new SearcherInfo(new ItunesPodcastSearcher(), 1.0f)); searchProviders.add(new SearcherInfo(new PodcastIndexPodcastSearcher(), 1.0f)); -- cgit v1.2.3