Remove gpodder search (#7047)

The search results are usually broken anyway
or the server just returns an error 500
This commit is contained in:
ByteHamster 2024-03-31 09:15:53 +02:00 committed by GitHub
parent 86ff7f540b
commit 4e47691e70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 0 additions and 106 deletions

View File

@ -34,7 +34,6 @@ import de.danoeh.antennapod.databinding.AddfeedBinding;
import de.danoeh.antennapod.databinding.EditTextDialogBinding; import de.danoeh.antennapod.databinding.EditTextDialogBinding;
import de.danoeh.antennapod.net.discovery.CombinedSearcher; import de.danoeh.antennapod.net.discovery.CombinedSearcher;
import de.danoeh.antennapod.net.discovery.FyydPodcastSearcher; import de.danoeh.antennapod.net.discovery.FyydPodcastSearcher;
import de.danoeh.antennapod.net.discovery.GpodnetPodcastSearcher;
import de.danoeh.antennapod.net.discovery.ItunesPodcastSearcher; import de.danoeh.antennapod.net.discovery.ItunesPodcastSearcher;
import de.danoeh.antennapod.net.discovery.PodcastIndexPodcastSearcher; import de.danoeh.antennapod.net.discovery.PodcastIndexPodcastSearcher;
import de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter; import de.danoeh.antennapod.ui.appstartintent.OnlineFeedviewActivityStarter;
@ -81,8 +80,6 @@ public class AddFeedFragment extends Fragment {
-> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class))); -> activity.loadChildFragment(OnlineSearchFragment.newInstance(ItunesPodcastSearcher.class)));
viewBinding.searchFyydButton.setOnClickListener(v viewBinding.searchFyydButton.setOnClickListener(v
-> activity.loadChildFragment(OnlineSearchFragment.newInstance(FyydPodcastSearcher.class))); -> activity.loadChildFragment(OnlineSearchFragment.newInstance(FyydPodcastSearcher.class)));
viewBinding.searchGPodderButton.setOnClickListener(v
-> activity.loadChildFragment(OnlineSearchFragment.newInstance(GpodnetPodcastSearcher.class)));
viewBinding.searchPodcastIndexButton.setOnClickListener(v viewBinding.searchPodcastIndexButton.setOnClickListener(v
-> activity.loadChildFragment(OnlineSearchFragment.newInstance(PodcastIndexPodcastSearcher.class))); -> activity.loadChildFragment(OnlineSearchFragment.newInstance(PodcastIndexPodcastSearcher.class)));

View File

@ -133,15 +133,6 @@
app:drawableLeftCompat="@drawable/ic_search" app:drawableLeftCompat="@drawable/ic_search"
style="@style/AddPodcastTextView" /> style="@style/AddPodcastTextView" />
<TextView
android:id="@+id/searchGPodderButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/gpodnet_search_hint"
app:drawableStartCompat="@drawable/ic_search"
app:drawableLeftCompat="@drawable/ic_search"
style="@style/AddPodcastTextView" />
<TextView <TextView
android:id="@+id/searchPodcastIndexButton" android:id="@+id/searchPodcastIndexButton"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -21,8 +21,6 @@ android {
dependencies { dependencies {
implementation project(':model') implementation project(':model')
implementation project(':net:common') implementation project(':net:common')
implementation project(':net:sync:gpoddernet')
implementation project(':net:sync:model')
implementation project(':storage:preferences') implementation project(':storage:preferences')
implementation project(':ui:i18n') implementation project(':ui:i18n')

View File

@ -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<List<PodcastSearchResult>> search(String query) {
return Single.create((SingleOnSubscribe<List<PodcastSearchResult>>) subscriber -> {
try {
GpodnetService service = new GpodnetService(AntennapodHttpClient.getHttpClient(),
SynchronizationCredentials.getHosturl(), SynchronizationCredentials.getDeviceId(),
SynchronizationCredentials.getUsername(), SynchronizationCredentials.getPassword());
List<GpodnetPodcast> gpodnetPodcasts = service.searchPodcasts(query, 0);
List<PodcastSearchResult> 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<String> lookupUrl(String url) {
return Single.just(url);
}
@Override
public boolean urlNeedsLookup(String url) {
return false;
}
@Override
public String getName() {
return "Gpodder.net";
}
}

View File

@ -1,7 +1,6 @@
package de.danoeh.antennapod.net.discovery; package de.danoeh.antennapod.net.discovery;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import de.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast;
import de.mfietz.fyydlin.SearchHit; import de.mfietz.fyydlin.SearchHit;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -93,13 +92,6 @@ public class PodcastSearchResult {
searchHit.getAuthor()); 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) { public static PodcastSearchResult fromPodcastIndex(JSONObject json) {
String title = json.optString("title", ""); String title = json.optString("title", "");
String imageUrl = json.optString("image", null); String imageUrl = json.optString("image", null);

View File

@ -15,7 +15,6 @@ public class PodcastSearcherRegistry {
if (searchProviders == null) { if (searchProviders == null) {
searchProviders = new ArrayList<>(); searchProviders = new ArrayList<>();
searchProviders.add(new SearcherInfo(new CombinedSearcher(), 1.0f)); 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 FyydPodcastSearcher(), 1.0f));
searchProviders.add(new SearcherInfo(new ItunesPodcastSearcher(), 1.0f)); searchProviders.add(new SearcherInfo(new ItunesPodcastSearcher(), 1.0f));
searchProviders.add(new SearcherInfo(new PodcastIndexPodcastSearcher(), 1.0f)); searchProviders.add(new SearcherInfo(new PodcastIndexPodcastSearcher(), 1.0f));

View File

@ -78,36 +78,6 @@ public class GpodnetService implements ISyncService {
} }
} }
/**
* Searches the podcast directory for a given string.
*
* @param query The search query
* @param scaledLogoSize The size of the logos that are returned by the search query.
* Must be in range 1..256. If the value is out of range, the
* default value defined by the gpodder.net API will be used.
*/
public List<GpodnetPodcast> searchPodcasts(String query, int scaledLogoSize) throws GpodnetServiceException {
String parameters = (scaledLogoSize > 0 && scaledLogoSize <= 256) ? String
.format(Locale.US, "q=%s&scale_logo=%d", query, scaledLogoSize) : String
.format("q=%s", query);
try {
URL url = new URI(baseScheme, null, baseHost, basePort, "/search.json",
parameters, 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 e) {
e.printStackTrace();
throw new GpodnetServiceException(e);
} catch (URISyntaxException e) {
e.printStackTrace();
throw new IllegalStateException(e);
}
}
/** /**
* Returns all devices of a given user. * Returns all devices of a given user.
* <p/> * <p/>

View File

@ -761,7 +761,6 @@
<string name="search_itunes_label">Search Apple Podcasts</string> <string name="search_itunes_label">Search Apple Podcasts</string>
<string name="search_podcastindex_label">Search Podcast Index</string> <string name="search_podcastindex_label">Search Podcast Index</string>
<string name="search_fyyd_label">Search fyyd</string> <string name="search_fyyd_label">Search fyyd</string>
<string name="gpodnet_search_hint">Search gpodder.net</string>
<string name="advanced">Advanced</string> <string name="advanced">Advanced</string>
<string name="add_podcast_by_url">Add podcast by RSS address</string> <string name="add_podcast_by_url">Add podcast by RSS address</string>
<string name="add_podcast_by_url_hint" translatable="false">www.example.com/feed</string> <string name="add_podcast_by_url_hint" translatable="false">www.example.com/feed</string>