[peertube] implement sepia search

This commit is contained in:
bopol 2020-12-23 15:14:26 +01:00
parent f3dbb19364
commit 81bbef04dc
3 changed files with 11 additions and 2 deletions

View File

@ -179,7 +179,7 @@ dependencies {
// NewPipe dependencies // NewPipe dependencies
// You can use a local version by uncommenting a few lines in settings.gradle // You can use a local version by uncommenting a few lines in settings.gradle
implementation 'com.github.TeamNewPipe:NewPipeExtractor:85fa006214b003f21eacb76c445a167732f19981' implementation 'com.github.B0pol:NewPipeExtractor:3ae924a7f18d5ee5b4aa0bd13d7179922cc094fa'
implementation "com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751" implementation "com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751"
implementation "org.jsoup:jsoup:1.13.1" implementation "org.jsoup:jsoup:1.13.1"

View File

@ -45,6 +45,8 @@ import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.search.SearchExtractor; import org.schabi.newpipe.extractor.search.SearchExtractor;
import org.schabi.newpipe.extractor.search.SearchInfo; import org.schabi.newpipe.extractor.search.SearchInfo;
import org.schabi.newpipe.extractor.services.peertube.linkHandler.PeertubeSearchQueryHandlerFactory;
import org.schabi.newpipe.extractor.services.youtube.linkHandler.YoutubeSearchQueryHandlerFactory;
import org.schabi.newpipe.fragments.BackPressable; import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.list.BaseListFragment; import org.schabi.newpipe.fragments.list.BaseListFragment;
import org.schabi.newpipe.local.history.HistoryRecordManager; import org.schabi.newpipe.local.history.HistoryRecordManager;
@ -419,12 +421,18 @@ public class SearchFragment extends BaseListFragment<SearchInfo, ListExtractor.I
boolean isFirstItem = true; boolean isFirstItem = true;
final Context c = getContext(); final Context c = getContext();
for (final String filter : service.getSearchQHFactory().getAvailableContentFilter()) { for (final String filter : service.getSearchQHFactory().getAvailableContentFilter()) {
if (filter.equals("music_songs")) { if (filter.equals(YoutubeSearchQueryHandlerFactory.MUSIC_SONGS)) {
final MenuItem musicItem = menu.add(2, final MenuItem musicItem = menu.add(2,
itemId++, itemId++,
0, 0,
"YouTube Music"); "YouTube Music");
musicItem.setEnabled(false); musicItem.setEnabled(false);
} else if (filter.equals(PeertubeSearchQueryHandlerFactory.SEPIA_VIDEOS)) {
final MenuItem sepiaItem = menu.add(2,
itemId++,
0,
"Sepia Search");
sepiaItem.setEnabled(false);
} }
menuItemToFilterName.put(itemId, filter); menuItemToFilterName.put(itemId, filter);
final MenuItem item = menu.add(1, final MenuItem item = menu.add(1,

View File

@ -48,6 +48,7 @@ public final class ServiceHelper {
case "all": case "all":
return c.getString(R.string.all); return c.getString(R.string.all);
case "videos": case "videos":
case "sepia_videos":
case "music_videos": case "music_videos":
return c.getString(R.string.videos_string); return c.getString(R.string.videos_string);
case "channels": case "channels":