Skip to content

Commit 5dd2daa

Browse files
committed
Finish transition to use getters on Info classes
- Renamed Collector method
1 parent 6c07b78 commit 5dd2daa

35 files changed

Lines changed: 392 additions & 397 deletions

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public interface Collector<I, E> {
3131
* Get all items
3232
* @return the items
3333
*/
34-
List<I> getItemList();
34+
List<I> getItems();
3535

3636
/**
3737
* Get all errors

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

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
public abstract class Info implements Serializable {
99

10-
public final int service_id;
10+
private final int serviceId;
1111
/**
1212
* Id of this Info object <br>
1313
* e.g. Youtube: https://www.youtube.com/watch?v=RER5qCTzZ7 &gt; RER5qCTzZ7
1414
*/
15-
public final String id;
16-
public final String url;
17-
public final String name;
15+
private final String id;
16+
private final String url;
17+
private final String name;
1818

19-
public final List<Throwable> errors = new ArrayList<>();
19+
private final List<Throwable> errors = new ArrayList<>();
2020

2121
public void addError(Throwable throwable) {
2222
this.errors.add(throwable);
@@ -27,20 +27,19 @@ public void addAllErrors(Collection<Throwable> errors) {
2727
}
2828

2929
public Info(int serviceId, String id, String url, String name) {
30-
this.service_id = serviceId;
30+
this.serviceId = serviceId;
3131
this.id = id;
3232
this.url = url;
3333
this.name = name;
3434
}
3535

36-
3736
@Override
3837
public String toString() {
3938
return getClass().getSimpleName() + "[url=\"" + url + "\", name=\"" + name + "\"]";
4039
}
4140

4241
public int getServiceId() {
43-
return service_id;
42+
return serviceId;
4443
}
4544

4645
public String getId() {

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,25 @@
2323
import java.io.Serializable;
2424

2525
public abstract class InfoItem implements Serializable {
26-
public final InfoType info_type;
27-
public final int service_id;
28-
public final String url;
29-
public final String name;
30-
public String thumbnail_url;
26+
private final InfoType infoType;
27+
private final int serviceId;
28+
private final String url;
29+
private final String name;
30+
private String thumbnailUrl;
3131

3232
public InfoItem(InfoType infoType, int serviceId, String url, String name) {
33-
this.info_type = infoType;
34-
this.service_id = serviceId;
33+
this.infoType = infoType;
34+
this.serviceId = serviceId;
3535
this.url = url;
3636
this.name = name;
3737
}
3838

3939
public InfoType getInfoType() {
40-
return info_type;
40+
return infoType;
4141
}
4242

4343
public int getServiceId() {
44-
return service_id;
44+
return serviceId;
4545
}
4646

4747
public String getUrl() {
@@ -53,11 +53,11 @@ public String getName() {
5353
}
5454

5555
public void setThumbnailUrl(String thumbnailUrl) {
56-
this.thumbnail_url = thumbnailUrl;
56+
this.thumbnailUrl = thumbnailUrl;
5757
}
5858

5959
public String getThumbnailUrl() {
60-
return thumbnail_url;
60+
return thumbnailUrl;
6161
}
6262

6363
@Override

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public InfoItemsCollector(int serviceId) {
4242
}
4343

4444
@Override
45-
public List<I> getItemList() {
45+
public List<I> getItems() {
4646
return Collections.unmodifiableList(itemList);
4747
}
4848

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static class InfoItemPage<T extends InfoItem> {
4646
private final List<Throwable> errors;
4747

4848
public InfoItemPage(InfoItemsCollector<T, ?> collector, String nextPageUrl) {
49-
this(collector.getItemList(), nextPageUrl, collector.getErrors());
49+
this(collector.getItems(), nextPageUrl, collector.getErrors());
5050
}
5151

5252
public InfoItemPage(List<T> itemsList, String nextPageUrl, List<Throwable> errors) {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
import java.util.List;
44

5-
public abstract class ListInfo extends Info {
6-
public List<InfoItem> related_streams;
7-
public String nextPageUrl = null;
5+
public abstract class ListInfo<T extends InfoItem> extends Info {
6+
private List<T> relatedItems;
7+
private String nextPageUrl = null;
88

99
public ListInfo(int serviceId, String id, String url, String name) {
1010
super(serviceId, id, url, name);
1111
}
1212

13-
public List<InfoItem> getRelatedStreams() {
14-
return related_streams;
13+
public List<T> getRelatedItems() {
14+
return relatedItems;
1515
}
1616

17-
public void setRelatedStreams(List<InfoItem> related_streams) {
18-
this.related_streams = related_streams;
17+
public void setRelatedItems(List<T> relatedItems) {
18+
this.relatedItems = relatedItems;
1919
}
2020

2121
public boolean hasNextPage() {

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

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
7979
info.addError(e);
8080
}
8181

82-
info.setRelatedStreams(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
82+
info.setRelatedItems(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
8383

8484
try {
8585
info.setSubscriberCount(extractor.getSubscriberCount());
@@ -96,42 +96,42 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
9696
return info;
9797
}
9898

99-
public String avatar_url;
100-
public String banner_url;
101-
public String feed_url;
102-
public long subscriber_count = -1;
103-
public String description;
99+
private String avatarUrl;
100+
private String bannerUrl;
101+
private String feedUrl;
102+
private long subscriberCount = -1;
103+
private String description;
104104

105105
public String getAvatarUrl() {
106-
return avatar_url;
106+
return avatarUrl;
107107
}
108108

109109
public void setAvatarUrl(String avatarUrl) {
110-
this.avatar_url = avatarUrl;
110+
this.avatarUrl = avatarUrl;
111111
}
112112

113113
public String getBannerUrl() {
114-
return banner_url;
114+
return bannerUrl;
115115
}
116116

117117
public void setBannerUrl(String bannerUrl) {
118-
this.banner_url = bannerUrl;
118+
this.bannerUrl = bannerUrl;
119119
}
120120

121121
public String getFeedUrl() {
122-
return feed_url;
122+
return feedUrl;
123123
}
124124

125125
public void setFeedUrl(String feedUrl) {
126-
this.feed_url = feedUrl;
126+
this.feedUrl = feedUrl;
127127
}
128128

129129
public long getSubscriberCount() {
130-
return subscriber_count;
130+
return subscriberCount;
131131
}
132132

133133
public void setSubscriberCount(long subscriberCount) {
134-
this.subscriber_count = subscriberCount;
134+
this.subscriberCount = subscriberCount;
135135
}
136136

137137
public String getDescription() {

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
public class ChannelInfoItem extends InfoItem {
2626

27-
public String description;
28-
public long subscriber_count = -1;
29-
public long stream_count = -1;
27+
private String description;
28+
private long subscriberCount = -1;
29+
private long streamCount = -1;
3030

3131

3232
public ChannelInfoItem(int serviceId, String url, String name) {
@@ -42,18 +42,18 @@ public void setDescription(String description) {
4242
}
4343

4444
public long getSubscriberCount() {
45-
return subscriber_count;
45+
return subscriberCount;
4646
}
4747

4848
public void setSubscriberCount(long subscriber_count) {
49-
this.subscriber_count = subscriber_count;
49+
this.subscriberCount = subscriber_count;
5050
}
5151

5252
public long getStreamCount() {
53-
return stream_count;
53+
return streamCount;
5454
}
5555

5656
public void setStreamCount(long stream_count) {
57-
this.stream_count = stream_count;
57+
this.streamCount = stream_count;
5858
}
5959
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static KioskInfo getInfo(KioskExtractor extractor) throws ExtractionExcep
7575

7676
KioskInfo info = new KioskInfo(serviceId, id, name, url);
7777

78-
info.related_streams = ExtractorHelper.getInfoItemsOrLogError(info, extractor);
78+
info.setRelatedItems(ExtractorHelper.getInfoItemsOrLogError(info, extractor));
7979

8080
return info;
8181
}

src/main/java/org/schabi/newpipe/extractor/playlist/PlaylistInfo.java

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -75,63 +75,63 @@ public static PlaylistInfo getInfo(PlaylistExtractor extractor) throws IOExcepti
7575
info.addError(e);
7676
}
7777

78-
info.setRelatedStreams(getInfoItemsOrLogError(info, extractor));
78+
info.setRelatedItems(getInfoItemsOrLogError(info, extractor));
7979
info.setNextPageUrl(extractor.getNextPageUrl());
8080
return info;
8181
}
8282

83-
public String thumbnail_url;
84-
public String banner_url;
85-
public String uploader_url;
86-
public String uploader_name;
87-
public String uploader_avatar_url;
88-
public long stream_count = 0;
83+
private String thumbnailUrl;
84+
private String bannerUrl;
85+
private String uploaderUrl;
86+
private String uploaderName;
87+
private String uploaderAvatarUrl;
88+
private long streamCount = 0;
8989

9090
public String getThumbnailUrl() {
91-
return thumbnail_url;
91+
return thumbnailUrl;
9292
}
9393

94-
public String getBannerUrl() {
95-
return banner_url;
94+
public void setThumbnailUrl(String thumbnailUrl) {
95+
this.thumbnailUrl = thumbnailUrl;
9696
}
9797

98-
public String getUploaderUrl() {
99-
return uploader_url;
98+
public String getBannerUrl() {
99+
return bannerUrl;
100100
}
101101

102-
public String getUploaderName() {
103-
return uploader_name;
102+
public void setBannerUrl(String bannerUrl) {
103+
this.bannerUrl = bannerUrl;
104104
}
105105

106-
public String getUploaderAvatarUrl() {
107-
return uploader_avatar_url;
106+
public String getUploaderUrl() {
107+
return uploaderUrl;
108108
}
109109

110-
public long getStreamCount() {
111-
return stream_count;
110+
public void setUploaderUrl(String uploaderUrl) {
111+
this.uploaderUrl = uploaderUrl;
112112
}
113113

114-
public void setThumbnailUrl(String thumbnailUrl) {
115-
this.thumbnail_url = thumbnailUrl;
114+
public String getUploaderName() {
115+
return uploaderName;
116116
}
117117

118-
public void setBannerUrl(String bannerUrl) {
119-
this.banner_url = bannerUrl;
118+
public void setUploaderName(String uploaderName) {
119+
this.uploaderName = uploaderName;
120120
}
121121

122-
public void setUploaderUrl(String uploaderUrl) {
123-
this.uploader_url = uploaderUrl;
122+
public String getUploaderAvatarUrl() {
123+
return uploaderAvatarUrl;
124124
}
125125

126-
public void setUploaderName(String uploaderName) {
127-
this.uploader_name = uploaderName;
126+
public void setUploaderAvatarUrl(String uploaderAvatarUrl) {
127+
this.uploaderAvatarUrl = uploaderAvatarUrl;
128128
}
129129

130-
public void setUploaderAvatarUrl(String uploaderAvatarUrl) {
131-
this.uploader_avatar_url = uploaderAvatarUrl;
130+
public long getStreamCount() {
131+
return streamCount;
132132
}
133133

134134
public void setStreamCount(long streamCount) {
135-
this.stream_count = streamCount;
135+
this.streamCount = streamCount;
136136
}
137137
}

0 commit comments

Comments
 (0)