Move feed discovery backends to their own module

This commit is contained in:
ByteHamster 2022-04-25 23:10:18 +02:00
parent 20363ee41c
commit 30be4628ae
22 changed files with 71 additions and 39 deletions

View File

@ -26,14 +26,6 @@ android {
} }
buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"') buildConfigField "String", "COMMIT_HASH", ('"' + (commit.isEmpty() ? "Unknown commit" : commit) + '"')
if (project.hasProperty("podcastindexApiKey")) {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"' + podcastindexApiKey + '"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"' + podcastindexApiSecret + '"'
} else {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"XTMMQGA2YZ4WJUBYY4HK"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"XAaAhk4^2YBsTE33vdbwbZNj82ZRLABDDqFdKe7x"'
}
javaCompileOptions { javaCompileOptions {
annotationProcessorOptions { annotationProcessorOptions {
arguments = [eventBusIndex: 'de.danoeh.antennapod.ApEventBusIndex'] arguments = [eventBusIndex: 'de.danoeh.antennapod.ApEventBusIndex']
@ -113,6 +105,7 @@ dependencies {
implementation project(":core") implementation project(":core")
implementation project(":event") implementation project(":event")
implementation project(':model') implementation project(':model')
implementation project(':net:discovery')
implementation project(':net:sync:gpoddernet') implementation project(':net:sync:gpoddernet')
implementation project(':net:sync:model') implementation project(':net:sync:model')
implementation project(':parser:feed') implementation project(':parser:feed')
@ -157,7 +150,6 @@ dependencies {
implementation 'com.github.shts:TriangleLabelView:1.1.2' implementation 'com.github.shts:TriangleLabelView:1.1.2'
implementation 'com.leinardi.android:speed-dial:3.2.0' implementation 'com.leinardi.android:speed-dial:3.2.0'
implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion" implementation "com.github.AntennaPod:AntennaPod-AudioPlayer:$audioPlayerVersion"
implementation 'com.github.mfietz:fyydlin:v0.5.0'
implementation 'com.github.ByteHamster:SearchPreference:v2.0.0' implementation 'com.github.ByteHamster:SearchPreference:v2.0.0'
implementation 'com.github.skydoves:balloon:1.4.0' implementation 'com.github.skydoves:balloon:1.4.0'
implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3' implementation 'com.github.xabaras:RecyclerViewSwipeDecorator:1.3'

View File

@ -36,8 +36,6 @@ import de.danoeh.antennapod.core.service.download.DownloadService;
import de.danoeh.antennapod.core.service.download.DownloadRequestCreator; import de.danoeh.antennapod.core.service.download.DownloadRequestCreator;
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException; import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
import de.danoeh.antennapod.core.util.DownloadErrorLabel; import de.danoeh.antennapod.core.util.DownloadErrorLabel;
import de.danoeh.antennapod.discovery.CombinedSearcher;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
import de.danoeh.antennapod.event.FeedListUpdateEvent; import de.danoeh.antennapod.event.FeedListUpdateEvent;
import de.danoeh.antennapod.event.PlayerStatusEvent; import de.danoeh.antennapod.event.PlayerStatusEvent;
import de.danoeh.antennapod.core.glide.ApGlideSettings; import de.danoeh.antennapod.core.glide.ApGlideSettings;
@ -51,6 +49,9 @@ import de.danoeh.antennapod.core.service.download.HttpDownloader;
import de.danoeh.antennapod.core.service.playback.PlaybackService; import de.danoeh.antennapod.core.service.playback.PlaybackService;
import de.danoeh.antennapod.core.storage.DBReader; import de.danoeh.antennapod.core.storage.DBReader;
import de.danoeh.antennapod.core.storage.DBWriter; import de.danoeh.antennapod.core.storage.DBWriter;
import de.danoeh.antennapod.net.discovery.CombinedSearcher;
import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
import de.danoeh.antennapod.net.discovery.PodcastSearcherRegistry;
import de.danoeh.antennapod.parser.feed.FeedHandler; import de.danoeh.antennapod.parser.feed.FeedHandler;
import de.danoeh.antennapod.parser.feed.FeedHandlerResult; import de.danoeh.antennapod.parser.feed.FeedHandlerResult;
import de.danoeh.antennapod.model.download.DownloadError; import de.danoeh.antennapod.model.download.DownloadError;
@ -61,7 +62,6 @@ import de.danoeh.antennapod.core.util.syndication.FeedDiscoverer;
import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText; import de.danoeh.antennapod.core.util.syndication.HtmlToPlainText;
import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding; import de.danoeh.antennapod.databinding.OnlinefeedviewActivityBinding;
import de.danoeh.antennapod.dialog.AuthenticationDialog; import de.danoeh.antennapod.dialog.AuthenticationDialog;
import de.danoeh.antennapod.discovery.PodcastSearcherRegistry;
import de.danoeh.antennapod.model.feed.Feed; import de.danoeh.antennapod.model.feed.Feed;
import de.danoeh.antennapod.model.feed.FeedPreferences; import de.danoeh.antennapod.model.feed.FeedPreferences;
import de.danoeh.antennapod.model.playback.RemoteMedia; import de.danoeh.antennapod.model.playback.RemoteMedia;

View File

@ -8,7 +8,7 @@ import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.discovery.PodcastSearchResult; import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -1,10 +1,10 @@
package de.danoeh.antennapod.adapter.itunes; package de.danoeh.antennapod.adapter.itunes;
import android.content.Context; import android.content.Context;
import android.widget.ArrayAdapter;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -14,12 +14,12 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.load.resource.bitmap.FitCenter; import com.bumptech.glide.load.resource.bitmap.FitCenter;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners; import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions; import com.bumptech.glide.request.RequestOptions;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
import java.util.List; import java.util.List;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> { public class ItunesAdapter extends ArrayAdapter<PodcastSearchResult> {
/** /**

View File

@ -35,11 +35,11 @@ import de.danoeh.antennapod.core.storage.DBTasks;
import de.danoeh.antennapod.model.feed.SortOrder; import de.danoeh.antennapod.model.feed.SortOrder;
import de.danoeh.antennapod.databinding.AddfeedBinding; import de.danoeh.antennapod.databinding.AddfeedBinding;
import de.danoeh.antennapod.databinding.EditTextDialogBinding; import de.danoeh.antennapod.databinding.EditTextDialogBinding;
import de.danoeh.antennapod.discovery.CombinedSearcher;
import de.danoeh.antennapod.discovery.FyydPodcastSearcher;
import de.danoeh.antennapod.discovery.ItunesPodcastSearcher;
import de.danoeh.antennapod.discovery.PodcastIndexPodcastSearcher;
import de.danoeh.antennapod.fragment.gpodnet.GpodnetMainFragment; import de.danoeh.antennapod.fragment.gpodnet.GpodnetMainFragment;
import de.danoeh.antennapod.net.discovery.CombinedSearcher;
import de.danoeh.antennapod.net.discovery.FyydPodcastSearcher;
import de.danoeh.antennapod.net.discovery.ItunesPodcastSearcher;
import de.danoeh.antennapod.net.discovery.PodcastIndexPodcastSearcher;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers; import io.reactivex.schedulers.Schedulers;

View File

@ -18,14 +18,14 @@ import androidx.annotation.NonNull;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import de.danoeh.antennapod.net.discovery.ItunesTopListLoader;
import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.itunes.ItunesAdapter; import de.danoeh.antennapod.adapter.itunes.ItunesAdapter;
import de.danoeh.antennapod.event.DiscoveryDefaultUpdateEvent; import de.danoeh.antennapod.event.DiscoveryDefaultUpdateEvent;
import de.danoeh.antennapod.discovery.ItunesTopListLoader;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -23,9 +23,9 @@ import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.itunes.ItunesAdapter; import de.danoeh.antennapod.adapter.itunes.ItunesAdapter;
import de.danoeh.antennapod.discovery.PodcastSearchResult; import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
import de.danoeh.antennapod.discovery.PodcastSearcher; import de.danoeh.antennapod.net.discovery.PodcastSearcher;
import de.danoeh.antennapod.discovery.PodcastSearcherRegistry; import de.danoeh.antennapod.net.discovery.PodcastSearcherRegistry;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -17,6 +17,8 @@ import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import de.danoeh.antennapod.net.discovery.ItunesTopListLoader;
import de.danoeh.antennapod.net.discovery.PodcastSearchResult;
import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode; import org.greenrobot.eventbus.ThreadMode;
@ -26,8 +28,6 @@ import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.activity.OnlineFeedViewActivity;
import de.danoeh.antennapod.adapter.FeedDiscoverAdapter; import de.danoeh.antennapod.adapter.FeedDiscoverAdapter;
import de.danoeh.antennapod.event.DiscoveryDefaultUpdateEvent; import de.danoeh.antennapod.event.DiscoveryDefaultUpdateEvent;
import de.danoeh.antennapod.discovery.ItunesTopListLoader;
import de.danoeh.antennapod.discovery.PodcastSearchResult;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -19,8 +19,8 @@ import com.google.android.material.tabs.TabLayoutMediator;
import de.danoeh.antennapod.R; import de.danoeh.antennapod.R;
import de.danoeh.antennapod.activity.MainActivity; import de.danoeh.antennapod.activity.MainActivity;
import de.danoeh.antennapod.discovery.GpodnetPodcastSearcher;
import de.danoeh.antennapod.fragment.OnlineSearchFragment; import de.danoeh.antennapod.fragment.OnlineSearchFragment;
import de.danoeh.antennapod.net.discovery.GpodnetPodcastSearcher;
/** /**
* Main navigation hub for gpodder.net podcast directory * Main navigation hub for gpodder.net podcast directory

3
net/discovery/README.md Normal file
View File

@ -0,0 +1,3 @@
# :net:discovery
This module contains the podcast search/discovery APIs.

View File

@ -0,0 +1,37 @@
plugins {
id("com.android.library")
}
apply from: "../../common.gradle"
apply from: "../../playFlavor.gradle"
android {
defaultConfig {
if (project.hasProperty("podcastindexApiKey")) {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"' + podcastindexApiKey + '"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"' + podcastindexApiSecret + '"'
} else {
buildConfigField "String", "PODCASTINDEX_API_KEY", '"XTMMQGA2YZ4WJUBYY4HK"'
buildConfigField "String", "PODCASTINDEX_API_SECRET", '"XAaAhk4^2YBsTE33vdbwbZNj82ZRLABDDqFdKe7x"'
}
}
lintOptions {
disable 'InvalidPeriodicWorkRequestInterval', 'MissingPermission',
'GradleCompatible', 'AppCompatResource', 'QueryPermissionsNeeded'
}
}
dependencies {
implementation project(':core')
implementation project(':model')
implementation project(':net:sync:gpoddernet')
implementation project(':net:sync:model')
annotationProcessor "androidx.annotation:annotation:$annotationVersion"
implementation 'com.github.mfietz:fyydlin:v0.5.0'
implementation "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
}

View File

@ -0,0 +1 @@
<manifest package="de.danoeh.antennapod.net.discovery" />

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import de.mfietz.fyydlin.FyydClient; import de.mfietz.fyydlin.FyydClient;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import de.danoeh.antennapod.core.sync.SynchronizationCredentials; import de.danoeh.antennapod.core.sync.SynchronizationCredentials;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException; import de.danoeh.antennapod.core.feed.FeedUrlNotFoundException;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;

View File

@ -1,9 +1,8 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import android.content.Context; import android.content.Context;
import android.util.Log; import android.util.Log;
import de.danoeh.antennapod.R;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import io.reactivex.Single; import io.reactivex.Single;
import io.reactivex.SingleOnSubscribe; import io.reactivex.SingleOnSubscribe;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
@ -15,7 +15,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.TimeZone; import java.util.TimeZone;
import de.danoeh.antennapod.BuildConfig; import de.danoeh.antennapod.net.discovery.BuildConfig;
import de.danoeh.antennapod.core.ClientConfig; import de.danoeh.antennapod.core.ClientConfig;
import de.danoeh.antennapod.core.service.download.AntennapodHttpClient; import de.danoeh.antennapod.core.service.download.AntennapodHttpClient;
import io.reactivex.Single; import io.reactivex.Single;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.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.danoeh.antennapod.net.sync.gpoddernet.model.GpodnetPodcast;

View File

@ -1,4 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import io.reactivex.Single; import io.reactivex.Single;
import java.util.List; import java.util.List;

View File

@ -1,5 +1,4 @@
package de.danoeh.antennapod.discovery; package de.danoeh.antennapod.net.discovery;
import io.reactivex.Single; import io.reactivex.Single;

View File

@ -3,6 +3,7 @@ include ':core'
include ':event' include ':event'
include ':model' include ':model'
include ':net:discovery'
include ':net:ssl' include ':net:ssl'
include ':net:sync:gpoddernet' include ':net:sync:gpoddernet'
include ':net:sync:model' include ':net:sync:model'