From 81bbef04dc7f46e5e2cf94e572d7713ddd2772c2 Mon Sep 17 00:00:00 2001 From: bopol Date: Wed, 23 Dec 2020 15:14:26 +0100 Subject: [PATCH 1/2] [peertube] implement sepia search --- app/build.gradle | 2 +- .../newpipe/fragments/list/search/SearchFragment.java | 10 +++++++++- .../java/org/schabi/newpipe/util/ServiceHelper.java | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3ac8ff525dd..0d3cf61a8a9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -179,7 +179,7 @@ dependencies { // NewPipe dependencies // 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 "org.jsoup:jsoup:1.13.1" diff --git a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java index 02dbf176bc5..4b7b1c3db88 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/list/search/SearchFragment.java @@ -45,6 +45,8 @@ import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.search.SearchExtractor; 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.list.BaseListFragment; import org.schabi.newpipe.local.history.HistoryRecordManager; @@ -419,12 +421,18 @@ public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { boolean isFirstItem = true; final Context c = getContext(); for (final String filter : service.getSearchQHFactory().getAvailableContentFilter()) { - if (filter.equals("music_songs")) { + if (filter.equals(YoutubeSearchQueryHandlerFactory.MUSIC_SONGS)) { final MenuItem musicItem = menu.add(2, itemId++, 0, "YouTube Music"); 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); final MenuItem item = menu.add(1, diff --git a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java index 8f3423b2253..a6756991c5c 100644 --- a/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java +++ b/app/src/main/java/org/schabi/newpipe/util/ServiceHelper.java @@ -48,6 +48,7 @@ public static String getTranslatedFilterString(final String filter, final Contex case "all": return c.getString(R.string.all); case "videos": + case "sepia_videos": case "music_videos": return c.getString(R.string.videos_string); case "channels": From 43e4dc817034bbf6df6eb43ff09083539e960eac Mon Sep 17 00:00:00 2001 From: bopol Date: Sun, 10 Jan 2021 15:54:01 +0100 Subject: [PATCH 2/2] update extractor version --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 9fb9cf85fe7..f2c84644251 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -179,7 +179,7 @@ dependencies { // NewPipe dependencies // You can use a local version by uncommenting a few lines in settings.gradle - implementation 'com.github.TeamNewPipe:NewPipeExtractor:deb9af7bf53b3f8fd9d32322adae02df78d985ea' + implementation 'com.github.TeamNewPipe:NewPipeExtractor:2d93b237236b8dce98943fd5dced9b8e645a2e0a' implementation "com.github.TeamNewPipe:nanojson:1d9e1aea9049fc9f85e68b43ba39fe7be1c1f751" implementation "org.jsoup:jsoup:1.13.1"