Skip to content

Commit bd5423f

Browse files
committed
make less tests fail
1 parent 17f46b8 commit bd5423f

59 files changed

Lines changed: 581 additions & 398 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

extractor/src/main/java/org/schabi/newpipe/extractor/Extractor.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
44
import org.schabi.newpipe.extractor.exceptions.ParsingException;
5+
import org.schabi.newpipe.extractor.uih.UIHandler;
6+
import org.schabi.newpipe.extractor.uih.UIHandler;
57

68
import javax.annotation.Nonnull;
79
import javax.annotation.Nullable;
@@ -14,27 +16,27 @@ public abstract class Extractor {
1416
*/
1517
private final StreamingService service;
1618

17-
private final UIHFactory UIHFactory;
19+
private final org.schabi.newpipe.extractor.uih.UIHandler uIHandler;
1820

1921
@Nullable
2022
private boolean pageFetched = false;
2123
private final Downloader downloader;
2224

23-
public Extractor(final StreamingService service, final UIHFactory UIHFactory) {
25+
public Extractor(final StreamingService service, final UIHandler uIHandler) {
2426
if(service == null) throw new NullPointerException("service is null");
25-
if(UIHFactory == null) throw new NullPointerException("UIHFactory is null");
27+
if(uIHandler == null) throw new NullPointerException("UIHandler is null");
2628
this.service = service;
27-
this.UIHFactory = UIHFactory;
29+
this.uIHandler = uIHandler;
2830
this.downloader = NewPipe.getDownloader();
2931
if(downloader == null) throw new NullPointerException("downloader is null");
3032
}
3133

3234
/**
33-
* @return The {@link UIHFactory} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler).
35+
* @return The {@link UIHandler} of the current extractor object (e.g. a ChannelExtractor should return a channel url handler).
3436
*/
3537
@Nonnull
36-
public UIHFactory getUIHFactory() {
37-
return UIHFactory;
38+
public UIHandler getUIHandler() {
39+
return uIHandler;
3840
}
3941

4042
/**
@@ -66,7 +68,7 @@ protected boolean isPageFetched() {
6668

6769
@Nonnull
6870
public String getId() throws ParsingException {
69-
return UIHFactory.getId();
71+
return uIHandler.getId();
7072
}
7173

7274
/**
@@ -79,12 +81,12 @@ public String getId() throws ParsingException {
7981

8082
@Nonnull
8183
public String getOriginalUrl() throws ParsingException {
82-
return UIHFactory.getOriginalUrl();
84+
return uIHandler.getOriginalUrl();
8385
}
8486

8587
@Nonnull
8688
public String getUrl() throws ParsingException {
87-
return UIHFactory.getUrl();
89+
return uIHandler.getUrl();
8890
}
8991

9092
@Nonnull

extractor/src/main/java/org/schabi/newpipe/extractor/Info.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.schabi.newpipe.extractor;
22

33
import org.schabi.newpipe.extractor.exceptions.ParsingException;
4+
import org.schabi.newpipe.extractor.uih.UIHFactory;
5+
import org.schabi.newpipe.extractor.uih.UIHandler;
46

57
import java.io.Serializable;
68
import java.util.ArrayList;
@@ -18,7 +20,7 @@ public abstract class Info implements Serializable {
1820
/**
1921
* Different than the {@link #originalUrl} in the sense that it <i>may</i> be set as a cleaned url.
2022
*
21-
* @see UIHFactory#getUrl()
23+
* @see UIHandler#getUrl()
2224
* @see Extractor#getOriginalUrl()
2325
*/
2426
private final String url;
@@ -48,11 +50,11 @@ public Info(int serviceId, String id, String url, String originalUrl, String nam
4850
this.name = name;
4951
}
5052

51-
public Info(int serviceId, UIHFactory UIHFactory, String name) throws ParsingException {
53+
public Info(int serviceId, UIHandler uiHandler, String name) {
5254
this(serviceId,
53-
UIHFactory.getId(),
54-
UIHFactory.getUrl(),
55-
UIHFactory.getOriginalUrl(),
55+
uiHandler.getId(),
56+
uiHandler.getUrl(),
57+
uiHandler.getOriginalUrl(),
5658
name);
5759
}
5860

extractor/src/main/java/org/schabi/newpipe/extractor/ListExtractor.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
package org.schabi.newpipe.extractor;
22

33
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
4+
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
5+
import org.schabi.newpipe.extractor.uih.ListUIHandler;
46

57
import javax.annotation.Nonnull;
8+
import javax.swing.plaf.ListUI;
69
import java.io.IOException;
710
import java.util.Collections;
811
import java.util.List;
@@ -12,8 +15,8 @@
1215
*/
1316
public abstract class ListExtractor<R extends InfoItem> extends Extractor {
1417

15-
public ListExtractor(StreamingService service, ListUIHFactory urlIdHandler) {
16-
super(service, urlIdHandler);
18+
public ListExtractor(StreamingService service, ListUIHandler uiHandler) {
19+
super(service, uiHandler);
1720
}
1821

1922
/**
@@ -50,8 +53,8 @@ public boolean hasNextPage() throws IOException, ExtractionException {
5053
}
5154

5255
@Override
53-
public ListUIHFactory getUIHFactory() {
54-
return (ListUIHFactory) super.getUIHFactory();
56+
public ListUIHandler getUIHandler() {
57+
return (ListUIHandler) super.getUIHandler();
5558
}
5659

5760
/*//////////////////////////////////////////////////////////////////////////

extractor/src/main/java/org/schabi/newpipe/extractor/ListInfo.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package org.schabi.newpipe.extractor;
22

33
import org.schabi.newpipe.extractor.exceptions.ParsingException;
4+
import org.schabi.newpipe.extractor.uih.ListUIHandler;
45

56
import java.util.ArrayList;
67
import java.util.List;
78

89
public abstract class ListInfo<T extends InfoItem> extends Info {
910
private List<T> relatedItems;
1011
private String nextPageUrl = null;
11-
private List<String> contentFilter = new ArrayList<>();
12+
private List<String> contentFilters = new ArrayList<>();
1213
private String sortFilter = "";
1314

1415
public ListInfo(int serviceId,
@@ -19,13 +20,13 @@ public ListInfo(int serviceId,
1920
List<String> contentFilter,
2021
String sortFilter) {
2122
super(serviceId, id, url, originalUrl, name);
22-
this.contentFilter = contentFilter;
23+
this.contentFilters = contentFilter;
2324
this.sortFilter = sortFilter;
2425
}
2526

26-
public ListInfo(int serviceId, ListUIHFactory listUrlIdHandler, String name) throws ParsingException {
27+
public ListInfo(int serviceId, ListUIHandler listUrlIdHandler, String name) throws ParsingException {
2728
super(serviceId, listUrlIdHandler, name);
28-
this.contentFilter = listUrlIdHandler.getContentFilter();
29+
this.contentFilters = listUrlIdHandler.getContentFilters();
2930
this.sortFilter = listUrlIdHandler.getSortFilter();
3031
}
3132

@@ -49,8 +50,8 @@ public void setNextPageUrl(String pageUrl) {
4950
this.nextPageUrl = pageUrl;
5051
}
5152

52-
public List<String> getContentFilter() {
53-
return contentFilter;
53+
public List<String> getContentFilters() {
54+
return contentFilters;
5455
}
5556

5657
public String getSortFilter() {

extractor/src/main/java/org/schabi/newpipe/extractor/ListUIHFactory.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

extractor/src/main/java/org/schabi/newpipe/extractor/StreamingService.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.schabi.newpipe.extractor.kiosk.KioskList;
77
import org.schabi.newpipe.extractor.playlist.PlaylistExtractor;
88
import org.schabi.newpipe.extractor.search.SearchExtractor;
9-
import org.schabi.newpipe.extractor.search.SearchQIHFactory;
9+
import org.schabi.newpipe.extractor.uih.*;
1010
import org.schabi.newpipe.extractor.stream.StreamExtractor;
1111
import org.schabi.newpipe.extractor.subscription.SubscriptionExtractor;
1212

@@ -76,41 +76,41 @@ public String toString() {
7676
////////////////////////////////////////////
7777
// Extractor
7878
////////////////////////////////////////////
79-
public abstract SearchExtractor getSearchExtractor(SearchQIHFactory queryHandler, String contentCountry);
79+
public abstract SearchExtractor getSearchExtractor(SearchQIHandler queryHandler, String contentCountry);
8080
public abstract SuggestionExtractor getSuggestionExtractor();
8181
public abstract SubscriptionExtractor getSubscriptionExtractor();
8282
public abstract KioskList getKioskList() throws ExtractionException;
8383

84-
public abstract ChannelExtractor getChannelExtractor(ListUIHFactory urlIdHandler) throws ExtractionException;
85-
public abstract PlaylistExtractor getPlaylistExtractor(ListUIHFactory urlIdHandler) throws ExtractionException;
86-
public abstract StreamExtractor getStreamExtractor(UIHFactory UIHFactory) throws ExtractionException;
84+
public abstract ChannelExtractor getChannelExtractor(ListUIHandler urlIdHandler) throws ExtractionException;
85+
public abstract PlaylistExtractor getPlaylistExtractor(ListUIHandler urlIdHandler) throws ExtractionException;
86+
public abstract StreamExtractor getStreamExtractor(UIHandler UIHFactory) throws ExtractionException;
8787

8888
public SearchExtractor getSearchExtractor(String query, List<String> contentFilter, String sortFilter, String contentCountry) throws ExtractionException {
89-
return getSearchExtractor(getSearchQIHFactory().setQuery(query, contentFilter, sortFilter), contentCountry);
89+
return getSearchExtractor(getSearchQIHFactory().fromQuery(query, contentFilter, sortFilter), contentCountry);
9090
}
9191

9292
public ChannelExtractor getChannelExtractor(String id, List<String> contentFilter, String sortFilter) throws ExtractionException {
93-
return getChannelExtractor(getChannelUIHFactory().setQuery(id, contentFilter, sortFilter));
93+
return getChannelExtractor(getChannelUIHFactory().fromQuery(id, contentFilter, sortFilter));
9494
}
9595

9696
public PlaylistExtractor getPlaylistExtractor(String id, List<String> contentFilter, String sortFilter) throws ExtractionException {
97-
return getPlaylistExtractor(getPlaylistUIHFactory().setQuery(id, contentFilter, sortFilter));
97+
return getPlaylistExtractor(getPlaylistUIHFactory().fromQuery(id, contentFilter, sortFilter));
9898
}
9999

100100
public SearchExtractor getSearchExtractor(String query, String contentCountry) throws ExtractionException {
101-
return getSearchExtractor(getSearchQIHFactory().setQuery(query), contentCountry);
101+
return getSearchExtractor(getSearchQIHFactory().fromQuery(query), contentCountry);
102102
}
103103

104104
public ChannelExtractor getChannelExtractor(String url) throws ExtractionException {
105-
return getChannelExtractor(getChannelUIHFactory().setUrl(url));
105+
return getChannelExtractor(getChannelUIHFactory().fromUrl(url));
106106
}
107107

108108
public PlaylistExtractor getPlaylistExtractor(String url) throws ExtractionException {
109-
return getPlaylistExtractor(getPlaylistUIHFactory().setUrl(url));
109+
return getPlaylistExtractor(getPlaylistUIHFactory().fromUrl(url));
110110
}
111111

112112
public StreamExtractor getStreamExtractor(String url) throws ExtractionException {
113-
return getStreamExtractor(getStreamUIHFactory().setUrl(url));
113+
return getStreamExtractor(getStreamUIHFactory().fromUrl(url));
114114
}
115115

116116

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package org.schabi.newpipe.extractor.channel;
22

33
import org.schabi.newpipe.extractor.ListExtractor;
4-
import org.schabi.newpipe.extractor.ListUIHFactory;
54
import org.schabi.newpipe.extractor.StreamingService;
65
import org.schabi.newpipe.extractor.exceptions.ParsingException;
76
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
7+
import org.schabi.newpipe.extractor.uih.ListUIHandler;
88

99
/*
1010
* Created by Christian Schabesberger on 25.07.16.
@@ -28,7 +28,7 @@
2828

2929
public abstract class ChannelExtractor extends ListExtractor<StreamInfoItem> {
3030

31-
public ChannelExtractor(StreamingService service, ListUIHFactory urlIdHandler) {
31+
public ChannelExtractor(StreamingService service, ListUIHandler urlIdHandler) {
3232
super(service, urlIdHandler);
3333
}
3434

extractor/src/main/java/org/schabi/newpipe/extractor/channel/ChannelInfo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import org.schabi.newpipe.extractor.ListExtractor.InfoItemsPage;
44
import org.schabi.newpipe.extractor.ListInfo;
5-
import org.schabi.newpipe.extractor.ListUIHFactory;
5+
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
66
import org.schabi.newpipe.extractor.NewPipe;
77
import org.schabi.newpipe.extractor.StreamingService;
88
import org.schabi.newpipe.extractor.exceptions.ExtractionException;
99
import org.schabi.newpipe.extractor.exceptions.ParsingException;
1010
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
11+
import org.schabi.newpipe.extractor.uih.ListUIHandler;
1112
import org.schabi.newpipe.extractor.utils.ExtractorHelper;
1213

1314
import java.io.IOException;
@@ -34,7 +35,7 @@
3435

3536
public class ChannelInfo extends ListInfo<StreamInfoItem> {
3637

37-
public ChannelInfo(int serviceId, ListUIHFactory urlIdHandler, String name) throws ParsingException {
38+
public ChannelInfo(int serviceId, ListUIHandler urlIdHandler, String name) throws ParsingException {
3839
super(serviceId, urlIdHandler, name);
3940
}
4041

@@ -55,7 +56,7 @@ public static InfoItemsPage<StreamInfoItem> getMoreItems(StreamingService servic
5556
public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException, ExtractionException {
5657

5758
ChannelInfo info = new ChannelInfo(extractor.getServiceId(),
58-
extractor.getUIHFactory(),
59+
extractor.getUIHandler(),
5960
extractor.getName());
6061

6162

extractor/src/main/java/org/schabi/newpipe/extractor/kiosk/KioskExtractor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
*/
2222

2323
import org.schabi.newpipe.extractor.ListExtractor;
24-
import org.schabi.newpipe.extractor.ListUIHFactory;
24+
import org.schabi.newpipe.extractor.uih.ListUIHFactory;
2525
import org.schabi.newpipe.extractor.StreamingService;
2626
import org.schabi.newpipe.extractor.exceptions.ParsingException;
2727
import org.schabi.newpipe.extractor.stream.StreamInfoItem;
28+
import org.schabi.newpipe.extractor.uih.ListUIHandler;
2829

2930
import javax.annotation.Nonnull;
3031

@@ -33,7 +34,7 @@ public abstract class KioskExtractor extends ListExtractor<StreamInfoItem> {
3334
private final String id;
3435

3536
public KioskExtractor(StreamingService streamingService,
36-
ListUIHFactory urlIdHandler,
37+
ListUIHandler urlIdHandler,
3738
String kioskId) {
3839
super(streamingService, urlIdHandler);
3940
this.id = kioskId;

0 commit comments

Comments
 (0)