From 3d2ded8af9e6306f0a3bea331f6354743c8c7a28 Mon Sep 17 00:00:00 2001 From: Matt Kohls Date: Mon, 12 Nov 2018 22:52:26 -0500 Subject: Got MediaWatcher working with MediaWatcherListener --- src/main/java/soundchan/BotListener/BotListener.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/soundchan/BotListener/BotListener.java b/src/main/java/soundchan/BotListener/BotListener.java index 6350d6d..77ed890 100644 --- a/src/main/java/soundchan/BotListener/BotListener.java +++ b/src/main/java/soundchan/BotListener/BotListener.java @@ -21,10 +21,7 @@ import soundchan.*; import java.nio.file.WatchEvent; import java.sql.SQLOutput; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; +import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; @@ -62,6 +59,7 @@ public class BotListener extends ListenerAdapter{ localFilePath = properties.getProperty("localFilePath"); followingUser = properties.getProperty("followingUser"); audioOnUserJoin = settingEnableCheck(properties.getProperty("audioOnUserJoin")); + otherTasks = new HashMap<>(); if(audioOnUserJoin) { String userAudioPath = properties.getProperty("userAudioFilePath"); if(userAudioPath == null || userAudioPath.contentEquals("")) { @@ -70,15 +68,12 @@ public class BotListener extends ListenerAdapter{ localManager = new LocalAudioManager(localFilePath, userAudioPath); if(settingEnableCheck(properties.getProperty("watchUserSoundFile"))) { - MediaWatcherListener listener = (event) -> System.out.println("thing"); - addWatcherTask(listener, userAudioPath, "watchUserSoundFile"); - /*addWatcherTask(new MediaWatcherListener() { + addWatcherTask(new MediaWatcherListener() { @Override public void runTask(WatchEvent event) { - System.out.println("Aaaa"); - //localManager.UpdateUserAudio(); + localManager.UpdateUserAudio(); } - }, userAudioPath, "watchUserSoundFile");*/ + }, userAudioPath, "watchUserSoundFile"); } } else @@ -88,8 +83,7 @@ public class BotListener extends ListenerAdapter{ addWatcherTask(new MediaWatcherListener() { @Override public void runTask(WatchEvent event) { - System.out.println("Oooo"); - //localManager.UpdateFiles(); + localManager.UpdateFiles(); } }, localFilePath, "watchLocalFilePath"); } -- cgit v1.2.3