Skip to content

Commit 79b0a19

Browse files
committed
make search filter empty be equal to all
1 parent d0efe8b commit 79b0a19

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/media_ccc/extractors/MediaCCCSearchExtractor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import com.grack.nanojson.JsonParserException;
77
import org.schabi.newpipe.extractor.Downloader;
88
import org.schabi.newpipe.extractor.InfoItem;
9-
import org.schabi.newpipe.extractor.InfoItemsCollector;
109
import org.schabi.newpipe.extractor.StreamingService;
1110
import org.schabi.newpipe.extractor.channel.ChannelInfoItem;
1211
import org.schabi.newpipe.extractor.channel.ChannelInfoItemExtractor;
@@ -16,7 +15,6 @@
1615
import org.schabi.newpipe.extractor.search.InfoItemsSearchCollector;
1716
import org.schabi.newpipe.extractor.search.SearchExtractor;
1817
import org.schabi.newpipe.extractor.services.media_ccc.extractors.infoItems.MediaCCCStreamInfoItemExtractor;
19-
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferenceLinkHandlerFactory;
2018
import org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCConferencesListLinkHandlerFactory;
2119
import org.schabi.newpipe.extractor.utils.Localization;
2220
import static org.schabi.newpipe.extractor.services.media_ccc.linkHandler.MediaCCCSearchQueryHandlerFactory.CONFERENCES;
@@ -54,14 +52,16 @@ public InfoItemsPage<InfoItem> getInitialPage() throws IOException, ExtractionEx
5452
InfoItemsSearchCollector searchItems = getInfoItemSearchCollector();
5553

5654
if(getLinkHandler().getContentFilters().contains(CONFERENCES)
57-
|| getLinkHandler().getContentFilters().contains(ALL)) {
55+
|| getLinkHandler().getContentFilters().contains(ALL)
56+
|| getLinkHandler().getContentFilters().isEmpty()) {
5857
searchConferences(getSearchString(),
5958
conferenceKiosk.getInitialPage().getItems(),
6059
searchItems);
6160
}
6261

6362
if(getLinkHandler().getContentFilters().contains(EVENTS)
64-
|| getLinkHandler().getContentFilters().contains(ALL)) {
63+
|| getLinkHandler().getContentFilters().contains(ALL)
64+
|| getLinkHandler().getContentFilters().isEmpty()) {
6565
JsonArray events = doc.getArray("events");
6666
for (int i = 0; i < events.size(); i++) {
6767
searchItems.commit(new MediaCCCStreamInfoItemExtractor(
@@ -84,7 +84,8 @@ public InfoItemsPage<InfoItem> getPage(String pageUrl) throws IOException, Extra
8484
@Override
8585
public void onFetchPage(@Nonnull Downloader downloader) throws IOException, ExtractionException {
8686
if(getLinkHandler().getContentFilters().contains(EVENTS)
87-
|| getLinkHandler().getContentFilters().contains(ALL)) {
87+
|| getLinkHandler().getContentFilters().contains(ALL)
88+
|| getLinkHandler().getContentFilters().isEmpty()) {
8889
final String site;
8990
final String url = getUrl();
9091
site = downloader.download(url, getLocalization());
@@ -95,7 +96,8 @@ public void onFetchPage(@Nonnull Downloader downloader) throws IOException, Extr
9596
}
9697
}
9798
if(getLinkHandler().getContentFilters().contains(CONFERENCES)
98-
|| getLinkHandler().getContentFilters().contains(ALL))
99+
|| getLinkHandler().getContentFilters().contains(ALL)
100+
|| getLinkHandler().getContentFilters().isEmpty())
99101
conferenceKiosk.fetchPage();
100102
}
101103

extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCSearchExtractorAllTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class MediaCCCSearchExtractorAllTest {
3030
public static void setUpClass() throws Exception {
3131
NewPipe.init(Downloader.getInstance(), new Localization("GB", "en"));
3232
extractor = MediaCCC.getSearchExtractor( new MediaCCCSearchQueryHandlerFactory()
33-
.fromQuery("c3", Arrays.asList(new String[] {"all"}), "")
33+
.fromQuery("c3", Arrays.asList(new String[0]), "")
3434
,new Localization("GB", "en"));
3535
extractor.fetchPage();
3636
itemsPage = extractor.getInitialPage();
@@ -40,7 +40,6 @@ public static void setUpClass() throws Exception {
4040
public void testIfChannelInfoItemsAvailable() {
4141
boolean isAvialable = false;
4242
for(InfoItem item : itemsPage.getItems()) {
43-
System.out.println(item);
4443
if(item instanceof ChannelInfoItem) {
4544
isAvialable = true;
4645
}
@@ -52,7 +51,6 @@ public void testIfChannelInfoItemsAvailable() {
5251
public void testIfStreamInfoitemsAvailable() {
5352
boolean isAvialable = false;
5453
for(InfoItem item : itemsPage.getItems()) {
55-
System.out.println(item);
5654
if(item instanceof StreamInfoItem) {
5755
isAvialable = true;
5856
}

0 commit comments

Comments
 (0)