aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/vtuber/ScheduleHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/vtuber/ScheduleHandler.java')
-rw-r--r--src/main/java/vtuber/ScheduleHandler.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/main/java/vtuber/ScheduleHandler.java b/src/main/java/vtuber/ScheduleHandler.java
index 094309b..2990bbf 100644
--- a/src/main/java/vtuber/ScheduleHandler.java
+++ b/src/main/java/vtuber/ScheduleHandler.java
@@ -2,7 +2,10 @@ package vtuber;
import com.pina.Holodex;
import com.pina.HolodexException;
+import com.pina.datatypes.Channel;
+import com.pina.datatypes.SimpleChannel;
import com.pina.datatypes.SimpleVideo;
+import com.pina.query.ChannelQueryBuilder;
import com.pina.query.VideoQueryBuilder;
import java.util.ArrayList;
@@ -62,4 +65,31 @@ public class ScheduleHandler {
return upcomingAndLiveVideos;
}
+
+ public boolean organizationExists(String org) {
+ List<Channel> channels = new ArrayList<>();
+ try {
+ channels = holodex.getChannels(new ChannelQueryBuilder().setOrg(org));
+ } catch (HolodexException e) {
+ System.out.println("Couldn't find organization with name " + org);
+ return false;
+ }
+ return channels.size() > 0;
+ }
+
+ public boolean channelExists(String channelId) {
+ Channel channel = new Channel();
+ try{
+ channel = holodex.getChannel(channelId);
+ if (channel.name == null) {
+ throw new HolodexException("Searching channel successful but no results found");
+ }
+ } catch (HolodexException e) {
+ System.out.println("Couldn't find channel with id " + channelId);
+ return false;
+ }
+ return true;
+ }
+
}
+
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage