aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/vtuber/ScheduleHandler.java
diff options
context:
space:
mode:
authorPinapelz <donaldshan1@outlook.com>2023-04-13 10:51:13 -0700
committerPinapelz <donaldshan1@outlook.com>2023-04-13 10:51:13 -0700
commita1198be0808056676bf553b151fe403068d8876c (patch)
tree82a48e86fc3628881bd8f48de39fe3fbd6970dc4 /src/main/java/vtuber/ScheduleHandler.java
parentc275f68217ff55b0fee324d7e1e08f61684b929d (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.java18
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;
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage