Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework content and sort filter framework #904

Open
wants to merge 40 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
3398a54
searchfilters: a framework to create sort and content filter objects
evermind-zz Aug 18, 2022
8409215
equals hashCode to FilterItem
Stypox Dec 29, 2023
3956e22
merge later ../extractor/src/main/java/org/schabi/newpipe/extractor/s…
evermind-zz Nov 13, 2022
b8eb121
searchfilters: convert core components to new framework
evermind-zz Aug 18, 2022
1dc746a
Changes due to channel tabs
Stypox Dec 29, 2023
9e75344
searchfilters: convert Peertube to new framework
evermind-zz Aug 18, 2022
c7ef8a9
[PeerTube]
Stypox Dec 29, 2023
f484f20
searchfilters: convert Soundcloud to use new framework
evermind-zz Aug 18, 2022
a043cbd
[SoundCloud]
Stypox Dec 29, 2023
17320ef
searchfilters: Soundcloud give empty page if no more results
evermind-zz Aug 19, 2022
d1bf446
searchfilters: Make SoundcloudSearchQueryHandlerFactory singleton
evermind-zz Aug 19, 2022
e084338
searchfilters: convert media_ccc to new framework
evermind-zz Aug 18, 2022
debb776
searchfilters: convert bandcamp to new framework
evermind-zz Aug 18, 2022
8568f19
[Bandcamp]
Stypox Dec 29, 2023
0a4b889
searchfilters: convert youtube to new framework
Stypox Dec 30, 2023
ec19719
[YouTube]
Stypox Dec 29, 2023
af1f1de
bandcamp: remove limit page.size as statement seems no longer true
evermind-zz Aug 18, 2022
d7b0430
searchfilters: added common helper methods for .*SearchExtractorTest's
evermind-zz Oct 11, 2022
49c3545
Fix base tests
Stypox Dec 30, 2023
e06fac6
searchfilters: Test: adjust PeerTube tests
evermind-zz Oct 11, 2022
c6b335c
Fix peertube tests
Stypox Dec 30, 2023
43479ab
searchfilters: Test: adjust SoundCloud tests
evermind-zz Oct 11, 2022
4a8b7f6
Fix soundcloud tests
Stypox Dec 30, 2023
1fc0fc7
searchfilters: Test: adjust MediaCCC tests
evermind-zz Oct 11, 2022
019ef62
searchfilters: Test: adjust Bandcamp tests
Stypox Dec 30, 2023
8280fd4
searchfilters: Test: adjust and extend YouTube tests
evermind-zz Oct 11, 2022
3e68e17
Fix yt tests
Stypox Dec 30, 2023
5a02063
searchfilters: unit tests for all derived BaseSearchFilters classes
evermind-zz Oct 20, 2022
1d552c4
searchfilters: an enum class which with strings ids that will be used…
evermind-zz Oct 28, 2022
78c8a60
searchfilters: convert to using LibraryStringIds to identify strings
evermind-zz Nov 1, 2022
11d268f
searchfilters: annotate methods and their parameters as Nullable or N…
evermind-zz Nov 13, 2022
4210592
searchfilters: annotate changed method signatures with Nullable or No…
evermind-zz Nov 13, 2022
0985afa
searchfilters: use base64 methods from okio to support <= Android Oreo
evermind-zz Nov 17, 2022
04f03ab
searchfilters: Moving DividerItem from NewPipeExtractor into NewPipe
evermind-zz Nov 22, 2022
e81796f
[Youtube] Update search mocks
Stypox Dec 30, 2023
23fe41d
searchfilters: Peertube: handle different endpoints for channel and p…
evermind-zz Feb 9, 2023
659deb0
searchfilters: Peertube: remove search option ID_CF_MAIN_ALL
evermind-zz Feb 11, 2023
dd252d3
searchfilters: bump squareup wire version to 4.5.2
evermind-zz Apr 4, 2023
70a2b63
searchfilters: Peertube restore different endpoints to fix peertube c…
evermind-zz Dec 30, 2023
67366ea
searchfilters: FilterItem now 'implements' Serializable to fix Parcel…
evermind-zz Jan 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Bandcamp]
Stypox committed Dec 30, 2023
commit 8568f196eca4cd3365a1d783ac1b6f295b1cb4b1
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
import org.schabi.newpipe.extractor.exceptions.ParsingException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandler;
import org.schabi.newpipe.extractor.search.filter.FilterItem;
import org.schabi.newpipe.extractor.services.bandcamp.extractors.streaminfoitem.BandcampDiscographStreamInfoItemExtractor;

import javax.annotation.Nonnull;
@@ -25,16 +26,13 @@ public BandcampChannelTabExtractor(final StreamingService service,
final ListLinkHandler linkHandler) {
super(service, linkHandler);

final String tab = linkHandler.getContentFilters().get(0);
switch (tab) {
case ChannelTabs.TRACKS:
filter = "track";
break;
case ChannelTabs.ALBUMS:
filter = "album";
break;
default:
throw new IllegalArgumentException("Unsupported channel tab: " + tab);
final FilterItem type = getChannelTabType();
if (type.equals(ChannelTabs.TRACKS)) {
filter = "track";
} else if (type.equals(ChannelTabs.ALBUMS)) {
filter = "album";
} else {
throw new IllegalArgumentException("Unsupported channel tab: " + type);
}
}

Original file line number Diff line number Diff line change
@@ -5,8 +5,11 @@
import org.schabi.newpipe.extractor.channel.tabs.ChannelTabs;
import org.schabi.newpipe.extractor.exceptions.UnsupportedTabException;
import org.schabi.newpipe.extractor.linkhandler.ListLinkHandlerFactory;
import org.schabi.newpipe.extractor.search.filter.FilterItem;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import java.util.List;

public final class BandcampChannelTabLinkHandlerFactory extends ListLinkHandlerFactory {
@@ -35,12 +38,12 @@ public static BandcampChannelTabLinkHandlerFactory getInstance() {
* @throws UnsupportedTabException if the tab is not supported
*/
@Nonnull
public static String getUrlSuffix(@Nonnull final String tab) throws UnsupportedTabException {
switch (tab) {
case ChannelTabs.TRACKS:
return "/track";
case ChannelTabs.ALBUMS:
return "/album";
public static String getUrlSuffix(@Nonnull final FilterItem tab)
throws UnsupportedTabException {
if (tab.equals(ChannelTabs.TRACKS)) {
return "/track";
} else if (tab.equals(ChannelTabs.ALBUMS)) {
return "/album";
}
throw new UnsupportedTabException(tab);
}
@@ -51,7 +54,9 @@ public String getId(final String url) throws ParsingException, UnsupportedOperat
}

@Override
public String getUrl(final String id, final List<String> contentFilter, final String sortFilter)
public String getUrl(final String id,
@Nonnull final List<FilterItem> contentFilter,
@Nullable final List<FilterItem> sortFilter)
throws ParsingException, UnsupportedOperationException {
return BandcampChannelLinkHandlerFactory.getInstance().getUrl(id)
+ getUrlSuffix(contentFilter.get(0));
@@ -61,12 +66,4 @@ public String getUrl(final String id, final List<String> contentFilter, final St
public boolean onAcceptUrl(final String url) throws ParsingException {
return BandcampChannelLinkHandlerFactory.getInstance().onAcceptUrl(url);
}

@Override
public String[] getAvailableContentFilter() {
return new String[]{
ChannelTabs.TRACKS,
ChannelTabs.ALBUMS,
};
}
}