diff --git a/sigIRCv2.jar b/sigIRCv2.jar index 7749d00..7c933c6 100644 Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ diff --git a/src/sig/modules/TwitchModule.java b/src/sig/modules/TwitchModule.java index b6970e5..0b50ee1 100644 --- a/src/sig/modules/TwitchModule.java +++ b/src/sig/modules/TwitchModule.java @@ -138,6 +138,7 @@ public class TwitchModule extends Module{ lastFollowerCheck = FOLLOWERCHECKTIMER; getFollowers(false); popFollowerFromQueue(); + isStreamOnline(true); } if (lastFollowerAnnouncement>0) { lastFollowerAnnouncement--; @@ -280,48 +281,55 @@ public class TwitchModule extends Module{ } } } - private boolean isStreamOnline() { - sigIRC.manager.streams().get(TextUtils.getActualChannelName(), new StreamResponseHandler() { - - @Override - public void onFailure(Throwable arg0) { - TwitchModule.streamOnline=false; - } - - @Override - public void onFailure(int arg0, String arg1, String arg2) { - System.out.println(arg0+","+arg1+","+arg2); - TwitchModule.streamOnline=false; - } + return isStreamOnline(false); + } - @Override - public void onSuccess(Stream arg0) { - //System.out.println("Stream data is available! "+arg0); - if (arg0==null) { + private boolean isStreamOnline(boolean update) { + if (update) { + sigIRC.manager.streams().get(TextUtils.getActualChannelName(), new StreamResponseHandler() { + + @Override + public void onFailure(Throwable arg0) { TwitchModule.streamOnline=false; - } else { - TwitchModule.streamOnline=true; - UpdateAllStreamStatistics(arg0); } - } - - private void UpdateAllStreamStatistics(Stream data) { - if (data!=null) { - if (data.getGame()!=null && data.getGame().length()>0) { - currentlyPlaying = data.getGame(); + + @Override + public void onFailure(int arg0, String arg1, String arg2) { + System.out.println(arg0+","+arg1+","+arg2); + TwitchModule.streamOnline=false; + } + + @Override + public void onSuccess(Stream arg0) { + //System.out.println("Stream data is available! "+arg0); + if (arg0==null) { + TwitchModule.streamOnline=false; + } else { + TwitchModule.streamOnline=true; + UpdateAllStreamStatistics(arg0); } - if (data.getCreatedAt()!=null) { - uptime = data.getCreatedAt(); + } + + private void UpdateAllStreamStatistics(Stream data) { + if (data!=null) { + if (data.getGame()!=null && data.getGame().length()>0) { + currentlyPlaying = data.getGame(); + } + if (data.getCreatedAt()!=null) { + uptime = data.getCreatedAt(); + } + viewers_numb.updateValue(data.getViewers()); + views_numb.updateValue((int)data.getChannel().getViews()); + followers_numb.updateValue(data.getChannel().getFollowers()); } - viewers_numb.updateValue(data.getViewers()); - views_numb.updateValue((int)data.getChannel().getViews()); - followers_numb.updateValue(data.getChannel().getFollowers()); } - } - - }); - return TwitchModule.streamOnline; + + }); + return TwitchModule.streamOnline; + } else { + return TwitchModule.streamOnline; + } //TwitchModule.streamOnline=true; //return true; }