Merge pull request #326 from wb9688/subchannel-parentchannel

Rename SubChannel in channels back to ParentChannel
This commit is contained in:
Tobias Groza 2020-05-08 17:40:49 +02:00 committed by GitHub
commit 3ddd6e4d7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 54 additions and 44 deletions

View File

@ -37,7 +37,7 @@ public abstract class ChannelExtractor extends ListExtractor<StreamInfoItem> {
public abstract String getFeedUrl() throws ParsingException; public abstract String getFeedUrl() throws ParsingException;
public abstract long getSubscriberCount() throws ParsingException; public abstract long getSubscriberCount() throws ParsingException;
public abstract String getDescription() throws ParsingException; public abstract String getDescription() throws ParsingException;
public abstract String getSubChannelName() throws ParsingException; public abstract String getParentChannelName() throws ParsingException;
public abstract String getSubChannelUrl() throws ParsingException; public abstract String getParentChannelUrl() throws ParsingException;
public abstract String getSubChannelAvatarUrl() throws ParsingException; public abstract String getParentChannelAvatarUrl() throws ParsingException;
} }

View File

@ -95,19 +95,19 @@ public class ChannelInfo extends ListInfo<StreamInfoItem> {
} }
try { try {
info.setSubChannelName(extractor.getSubChannelName()); info.setParentChannelName(extractor.getParentChannelName());
} catch (Exception e) { } catch (Exception e) {
info.addError(e); info.addError(e);
} }
try { try {
info.setSubChannelUrl(extractor.getSubChannelUrl()); info.setParentChannelUrl(extractor.getParentChannelUrl());
} catch (Exception e) { } catch (Exception e) {
info.addError(e); info.addError(e);
} }
try { try {
info.setSubChannelAvatarUrl(extractor.getSubChannelAvatarUrl()); info.setParentChannelAvatarUrl(extractor.getParentChannelAvatarUrl());
} catch (Exception e) { } catch (Exception e) {
info.addError(e); info.addError(e);
} }
@ -116,37 +116,37 @@ public class ChannelInfo extends ListInfo<StreamInfoItem> {
} }
private String avatarUrl; private String avatarUrl;
private String subChannelName; private String parentChannelName;
private String subChannelUrl; private String parentChannelUrl;
private String subChannelAvatarUrl; private String parentChannelAvatarUrl;
private String bannerUrl; private String bannerUrl;
private String feedUrl; private String feedUrl;
private long subscriberCount = -1; private long subscriberCount = -1;
private String description; private String description;
private String[] donationLinks; private String[] donationLinks;
public String getSubChannelName() { public String getParentChannelName() {
return subChannelName; return parentChannelName;
} }
public void setSubChannelName(String subChannelName) { public void setParentChannelName(String parentChannelName) {
this.subChannelName = subChannelName; this.parentChannelName = parentChannelName;
} }
public String getSubChannelUrl() { public String getParentChannelUrl() {
return subChannelUrl; return parentChannelUrl;
} }
public void setSubChannelUrl(String subChannelUrl) { public void setParentChannelUrl(String parentChannelUrl) {
this.subChannelUrl = subChannelUrl; this.parentChannelUrl = parentChannelUrl;
} }
public String getSubChannelAvatarUrl() { public String getParentChannelAvatarUrl() {
return subChannelAvatarUrl; return parentChannelAvatarUrl;
} }
public void setSubChannelAvatarUrl(String subChannelAvatarUrl) { public void setParentChannelAvatarUrl(String parentChannelAvatarUrl) {
this.subChannelAvatarUrl = subChannelAvatarUrl; this.parentChannelAvatarUrl = parentChannelAvatarUrl;
} }
public String getAvatarUrl() { public String getAvatarUrl() {

View File

@ -53,17 +53,17 @@ public class MediaCCCConferenceExtractor extends ChannelExtractor {
} }
@Override @Override
public String getSubChannelName() throws ParsingException { public String getParentChannelName() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelUrl() throws ParsingException { public String getParentChannelUrl() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelAvatarUrl() throws ParsingException { public String getParentChannelAvatarUrl() throws ParsingException {
return ""; return "";
} }

View File

@ -76,17 +76,17 @@ public class PeertubeAccountExtractor extends ChannelExtractor {
} }
@Override @Override
public String getSubChannelName() throws ParsingException { public String getParentChannelName() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelUrl() throws ParsingException { public String getParentChannelUrl() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelAvatarUrl() throws ParsingException { public String getParentChannelAvatarUrl() throws ParsingException {
return ""; return "";
} }

View File

@ -76,17 +76,17 @@ public class PeertubeChannelExtractor extends ChannelExtractor {
} }
@Override @Override
public String getSubChannelName() throws ParsingException { public String getParentChannelName() throws ParsingException {
return JsonUtils.getString(json, "ownerAccount.name"); return JsonUtils.getString(json, "ownerAccount.name");
} }
@Override @Override
public String getSubChannelUrl() throws ParsingException { public String getParentChannelUrl() throws ParsingException {
return JsonUtils.getString(json, "ownerAccount.url"); return JsonUtils.getString(json, "ownerAccount.url");
} }
@Override @Override
public String getSubChannelAvatarUrl() throws ParsingException { public String getParentChannelAvatarUrl() throws ParsingException {
String value; String value;
try { try {
value = JsonUtils.getString(json, "ownerAccount.avatar.path"); value = JsonUtils.getString(json, "ownerAccount.avatar.path");

View File

@ -84,17 +84,17 @@ public class SoundcloudChannelExtractor extends ChannelExtractor {
} }
@Override @Override
public String getSubChannelName() throws ParsingException { public String getParentChannelName() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelUrl() throws ParsingException { public String getParentChannelUrl() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelAvatarUrl() throws ParsingException { public String getParentChannelAvatarUrl() throws ParsingException {
return ""; return "";
} }

View File

@ -213,17 +213,17 @@ public class YoutubeChannelExtractor extends ChannelExtractor {
} }
@Override @Override
public String getSubChannelName() throws ParsingException { public String getParentChannelName() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelUrl() throws ParsingException { public String getParentChannelUrl() throws ParsingException {
return ""; return "";
} }
@Override @Override
public String getSubChannelAvatarUrl() throws ParsingException { public String getParentChannelAvatarUrl() throws ParsingException {
return ""; return "";
} }

View File

@ -85,13 +85,18 @@ public class PeertubeChannelExtractorTest {
} }
@Test @Test
public void testSubChannelName() throws ParsingException { public void testParentChannelName() throws ParsingException {
assertEquals("libux", extractor.getSubChannelName()); assertEquals("libux", extractor.getParentChannelName());
} }
@Test @Test
public void testSubChannelUrl() throws ParsingException { public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getSubChannelUrl()); assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getParentChannelUrl());
}
@Test
public void testParentChannelAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
} }
@Test @Test
@ -192,13 +197,18 @@ public class PeertubeChannelExtractorTest {
} }
@Test @Test
public void testSubChannelName() throws ParsingException { public void testParentChannelName() throws ParsingException {
assertEquals("booteille", extractor.getSubChannelName()); assertEquals("booteille", extractor.getParentChannelName());
} }
@Test @Test
public void testSubChannelUrl() throws ParsingException { public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getSubChannelUrl()); assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getParentChannelUrl());
}
@Test
public void testParentChannelAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
} }
@Test @Test