forked from MrBesen/YoutubeCrawler
changed to long polling
This commit is contained in:
parent
7713dcf56f
commit
080b14a4a0
|
@ -28,7 +28,7 @@ public class Main implements JSONCommandHandler {
|
|||
private static Main main;
|
||||
private boolean startcrawler = true;
|
||||
private Crawler cra;
|
||||
private Thread crawlerthread;
|
||||
private Thread maincrawlerthread;
|
||||
|
||||
public static Main getMain() {
|
||||
return main;
|
||||
|
@ -62,9 +62,9 @@ public class Main implements JSONCommandHandler {
|
|||
|
||||
//starting crawler
|
||||
cra = new Crawler();
|
||||
crawlerthread = new Thread(cra, "Crawler");
|
||||
maincrawlerthread = new Thread(cra, "Crawler");
|
||||
if(startcrawler) {
|
||||
crawlerthread.start();
|
||||
maincrawlerthread.start();
|
||||
}
|
||||
|
||||
//starting BOT API
|
||||
|
@ -72,7 +72,8 @@ public class Main implements JSONCommandHandler {
|
|||
tapi.getCommandManager().registerCommand( this);
|
||||
tapi.getEventManager().registerEvent(UserSendMessageEvent.class, this::onAdmin);
|
||||
tapi.setHelpText("Send the command /random to get a random video.");
|
||||
tapi.setUpdateInterval(2000);
|
||||
tapi.setUpdateInterval(60);
|
||||
tapi.setLongpolling(true);
|
||||
tapi.setLog(new Log4JLog());
|
||||
tapi.start();
|
||||
|
||||
|
@ -97,7 +98,7 @@ public class Main implements JSONCommandHandler {
|
|||
//CLI
|
||||
Scanner s = new Scanner(System.in);
|
||||
String in;
|
||||
while((in= s.nextLine()) != null && crawlerthread.isAlive()) {
|
||||
while((in = s.nextLine()) != null && maincrawlerthread.isAlive()) {
|
||||
if(in.equalsIgnoreCase("stop")) {
|
||||
stop();
|
||||
} else if(in.equalsIgnoreCase("add")) {
|
||||
|
|
Loading…
Reference in New Issue