diff options
| author | Yukai Shan <yukais6@uci.edu> | 2023-04-13 10:51:13 -0700 |
|---|---|---|
| committer | Yukai Shan <yukais6@uci.edu> | 2023-04-13 10:51:13 -0700 |
| commit | 5093c8a64bb77c0940f026023cbae878d9af53de (patch) | |
| tree | 82a48e86fc3628881bd8f48de39fe3fbd6970dc4 /src/main/java/vtuber/ScheduleHandler.java | |
| parent | 64b46b3d3a6a24043f1fff523fedb20ae229a068 (diff) | |
Implemented /schedule-channel command (schedule for individual channels)
Diffstat (limited to 'src/main/java/vtuber/ScheduleHandler.java')
| -rw-r--r-- | src/main/java/vtuber/ScheduleHandler.java | 18 |
1 files changed, 18 insertions, 0 deletions
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 @@ -64,6 +64,24 @@ public class ScheduleHandler { return upcomingAndLiveVideos; } + public List<SimpleVideo> getScheduleChannelId(String channelId, int limit) { + System.out.println("Getting schedule for " + channelId); + List<SimpleVideo> upcomingAndLiveVideos = new ArrayList<>(); + try { + List<SimpleVideo> upcomingVideos = holodex.getLiveAndUpcomingVideos(new VideoQueryBuilder().setChannelId(channelId).setStatus("upcoming")); + List<SimpleVideo> 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) { List<Channel> channels; |
