Skip to content

Commit

Permalink
Merge pull request #326 from wb9688/subchannel-parentchannel
Browse files Browse the repository at this point in the history
Rename SubChannel in channels back to ParentChannel
  • Loading branch information
TobiGr authored May 8, 2020
2 parents 44d382b + 7320108 commit 3ddd6e4
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ChannelExtractor(StreamingService service, ListLinkHandler linkHandler) {
public abstract String getFeedUrl() throws ParsingException;
public abstract long getSubscriberCount() throws ParsingException;
public abstract String getDescription() throws ParsingException;
public abstract String getSubChannelName() throws ParsingException;
public abstract String getSubChannelUrl() throws ParsingException;
public abstract String getSubChannelAvatarUrl() throws ParsingException;
public abstract String getParentChannelName() throws ParsingException;
public abstract String getParentChannelUrl() throws ParsingException;
public abstract String getParentChannelAvatarUrl() throws ParsingException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,19 +95,19 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
}

try {
info.setSubChannelName(extractor.getSubChannelName());
info.setParentChannelName(extractor.getParentChannelName());
} catch (Exception e) {
info.addError(e);
}

try {
info.setSubChannelUrl(extractor.getSubChannelUrl());
info.setParentChannelUrl(extractor.getParentChannelUrl());
} catch (Exception e) {
info.addError(e);
}

try {
info.setSubChannelAvatarUrl(extractor.getSubChannelAvatarUrl());
info.setParentChannelAvatarUrl(extractor.getParentChannelAvatarUrl());
} catch (Exception e) {
info.addError(e);
}
Expand All @@ -116,37 +116,37 @@ public static ChannelInfo getInfo(ChannelExtractor extractor) throws IOException
}

private String avatarUrl;
private String subChannelName;
private String subChannelUrl;
private String subChannelAvatarUrl;
private String parentChannelName;
private String parentChannelUrl;
private String parentChannelAvatarUrl;
private String bannerUrl;
private String feedUrl;
private long subscriberCount = -1;
private String description;
private String[] donationLinks;

public String getSubChannelName() {
return subChannelName;
public String getParentChannelName() {
return parentChannelName;
}

public void setSubChannelName(String subChannelName) {
this.subChannelName = subChannelName;
public void setParentChannelName(String parentChannelName) {
this.parentChannelName = parentChannelName;
}

public String getSubChannelUrl() {
return subChannelUrl;
public String getParentChannelUrl() {
return parentChannelUrl;
}

public void setSubChannelUrl(String subChannelUrl) {
this.subChannelUrl = subChannelUrl;
public void setParentChannelUrl(String parentChannelUrl) {
this.parentChannelUrl = parentChannelUrl;
}

public String getSubChannelAvatarUrl() {
return subChannelAvatarUrl;
public String getParentChannelAvatarUrl() {
return parentChannelAvatarUrl;
}

public void setSubChannelAvatarUrl(String subChannelAvatarUrl) {
this.subChannelAvatarUrl = subChannelAvatarUrl;
public void setParentChannelAvatarUrl(String parentChannelAvatarUrl) {
this.parentChannelAvatarUrl = parentChannelAvatarUrl;
}

public String getAvatarUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ public String getDescription() {
}

@Override
public String getSubChannelName() throws ParsingException {
public String getParentChannelName() throws ParsingException {
return "";
}

@Override
public String getSubChannelUrl() throws ParsingException {
public String getParentChannelUrl() throws ParsingException {
return "";
}

@Override
public String getSubChannelAvatarUrl() throws ParsingException {
public String getParentChannelAvatarUrl() throws ParsingException {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ public String getDescription() throws ParsingException {
}

@Override
public String getSubChannelName() throws ParsingException {
public String getParentChannelName() throws ParsingException {
return "";
}

@Override
public String getSubChannelUrl() throws ParsingException {
public String getParentChannelUrl() throws ParsingException {
return "";
}

@Override
public String getSubChannelAvatarUrl() throws ParsingException {
public String getParentChannelAvatarUrl() throws ParsingException {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ public String getDescription() throws ParsingException {
}

@Override
public String getSubChannelName() throws ParsingException {
public String getParentChannelName() throws ParsingException {
return JsonUtils.getString(json, "ownerAccount.name");
}

@Override
public String getSubChannelUrl() throws ParsingException {
public String getParentChannelUrl() throws ParsingException {
return JsonUtils.getString(json, "ownerAccount.url");
}

@Override
public String getSubChannelAvatarUrl() throws ParsingException {
public String getParentChannelAvatarUrl() throws ParsingException {
String value;
try {
value = JsonUtils.getString(json, "ownerAccount.avatar.path");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ public String getDescription() {
}

@Override
public String getSubChannelName() throws ParsingException {
public String getParentChannelName() throws ParsingException {
return "";
}

@Override
public String getSubChannelUrl() throws ParsingException {
public String getParentChannelUrl() throws ParsingException {
return "";
}

@Override
public String getSubChannelAvatarUrl() throws ParsingException {
public String getParentChannelAvatarUrl() throws ParsingException {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,17 +213,17 @@ public String getDescription() throws ParsingException {
}

@Override
public String getSubChannelName() throws ParsingException {
public String getParentChannelName() throws ParsingException {
return "";
}

@Override
public String getSubChannelUrl() throws ParsingException {
public String getParentChannelUrl() throws ParsingException {
return "";
}

@Override
public String getSubChannelAvatarUrl() throws ParsingException {
public String getParentChannelAvatarUrl() throws ParsingException {
return "";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,18 @@ public void testDescription() throws ParsingException {
}

@Test
public void testSubChannelName() throws ParsingException {
assertEquals("libux", extractor.getSubChannelName());
public void testParentChannelName() throws ParsingException {
assertEquals("libux", extractor.getParentChannelName());
}

@Test
public void testSubChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getSubChannelUrl());
public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/libux", extractor.getParentChannelUrl());
}

@Test
public void testParentChannelAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
}

@Test
Expand Down Expand Up @@ -192,13 +197,18 @@ public void testDescription() throws ParsingException {
}

@Test
public void testSubChannelName() throws ParsingException {
assertEquals("booteille", extractor.getSubChannelName());
public void testParentChannelName() throws ParsingException {
assertEquals("booteille", extractor.getParentChannelName());
}

@Test
public void testParentChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getParentChannelUrl());
}

@Test
public void testSubChannelUrl() throws ParsingException {
assertEquals("https://peertube.mastodon.host/accounts/booteille", extractor.getSubChannelUrl());
public void testParentChannelAvatarUrl() throws ParsingException {
assertIsSecureUrl(extractor.getParentChannelAvatarUrl());
}

@Test
Expand Down

0 comments on commit 3ddd6e4

Please sign in to comment.