From b08924a0be74e408f60381ec7424065d257e23aa Mon Sep 17 00:00:00 2001 From: Pinapelz Date: Thu, 13 Apr 2023 14:27:36 -0700 Subject: Implemented /schedule-channel command (schedule for individual channels) --- src/main/java/vtuber/ScheduleHandler.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main/java/vtuber/ScheduleHandler.java') diff --git a/src/main/java/vtuber/ScheduleHandler.java b/src/main/java/vtuber/ScheduleHandler.java index d921237..990b285 100644 --- a/src/main/java/vtuber/ScheduleHandler.java +++ b/src/main/java/vtuber/ScheduleHandler.java @@ -63,6 +63,24 @@ public class ScheduleHandler { } return upcomingAndLiveVideos; + } + public List getScheduleChannelId(String channelId, int limit) { + System.out.println("Getting schedule for " + channelId); + List upcomingAndLiveVideos = new ArrayList<>(); + try { + List upcomingVideos = holodex.getLiveAndUpcomingVideos(new VideoQueryBuilder().setChannelId(channelId).setStatus("upcoming")); + List liveVideos = holodex.getLiveAndUpcomingVideos(new VideoQueryBuilder().setStatus("live").setChannelId(channelId)); + upcomingAndLiveVideos.addAll(liveVideos); + upcomingAndLiveVideos.addAll(upcomingVideos); + if (upcomingAndLiveVideos.size() > limit) { + upcomingAndLiveVideos = upcomingAndLiveVideos.subList(0, limit); + } + } catch (HolodexException e) { + System.out.println("Error getting schedule for " + channelId); + System.out.println(e.getMessage()); + } + return upcomingAndLiveVideos; + } public boolean organizationExists(String org) { -- cgit v1.2.3