Updated sigIRCv2 to use new Twitch API features. Follower and twitch

stats data updates once again.
master
sigonasr2 5 years ago
parent 64cc36cd32
commit 427c4804a2
  1. 100
      .settings/org.eclipse.jdt.core.prefs
  2. BIN
      sigIRCv2.jar
  3. 7
      src/sig/Module.java
  4. 10
      src/sig/ModuleLinker.java
  5. 208
      src/sig/ModuleSelector.java
  6. 50
      src/sig/ModuleSelectorButton.java
  7. 13
      src/sig/MyPanel.java
  8. 17
      src/sig/modules/BandoriModule.java
  9. 17
      src/sig/modules/ChatLogModule.java
  10. 16
      src/sig/modules/ControllerModule.java
  11. 17
      src/sig/modules/DDRStepModule.java
  12. 16
      src/sig/modules/RabiRaceModule.java
  13. 17
      src/sig/modules/RabiRibiModule.java
  14. 16
      src/sig/modules/TouhouMotherModule.java
  15. 17
      src/sig/modules/Twitch/Announcement.java
  16. 18
      src/sig/modules/Twitch/Follower.java
  17. 346
      src/sig/modules/TwitchModule.java
  18. 86
      src/sig/sigIRC.java
  19. 18
      src/sig/utils/FileUtils.java

@ -1,4 +1,13 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@ -6,6 +15,97 @@ org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
org.eclipse.jdt.core.compiler.problem.deadCode=warning
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=ignore
org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.8

Binary file not shown.

@ -102,6 +102,13 @@ public class Module {
}
}
}
public static void loadModule() {
}
public static void unloadModule() {
}
private void dragWindow() {
if (sigIRC.showWindowControls) {

@ -0,0 +1,10 @@
package sig;
public class ModuleLinker {
public String name = "";
public Module mod;
public ModuleLinker(String name,Module mod) {
this.name = name;
this.mod = mod;
}
}

@ -0,0 +1,208 @@
package sig;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JColorChooser;
import javax.swing.JFrame;
import javax.swing.JPanel;
import sig.modules.BandoriModule;
import sig.modules.ChatLogModule;
import sig.modules.ControllerModule;
import sig.modules.DDRStepModule;
import sig.modules.RabiRaceModule;
import sig.modules.RabiRibiModule;
import sig.modules.TouhouMotherModule;
import sig.modules.TwitchModule;
public class ModuleSelector extends JFrame implements WindowListener{
public static JCheckBox bandoriBox = new JCheckBox("Bandori",sigIRC.bandorimodule_enabled);
public static JCheckBox ddrstepBox = new JCheckBox("DDR Step",sigIRC.ddrstepmodule_enabled);
public static JCheckBox rabiraceBox = new JCheckBox("Rabi Race",sigIRC.rabiracemodule_enabled);
public static JCheckBox rabiribiBox = new JCheckBox("Rabi Ribi (Broken)",sigIRC.rabiribimodule_enabled);
public static JCheckBox controllerBox = new JCheckBox("Controller",sigIRC.controllermodule_enabled);
public static JCheckBox chatlogBox = new JCheckBox("Chat Log",sigIRC.chatlogmodule_enabled);
public static JCheckBox twitchBox = new JCheckBox("Twitch",sigIRC.twitchmodule_enabled);
public static JCheckBox touhoumotherBox = new JCheckBox("Touhou Mother",sigIRC.touhoumothermodule_enabled);
public ModuleSelector() {
JPanel panel = new JPanel();
bandoriBox.setActionCommand("bandori");
bandoriBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("bandori")) {
if (ModuleSelector.bandoriBox.isSelected()) {
BandoriModule.loadModule();
} else {
BandoriModule.unloadModule();
}
}
}
});
bandoriBox.setVisible(true);
ddrstepBox.setActionCommand("ddrstep");
ddrstepBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("ddrstep")) {
if (ModuleSelector.ddrstepBox.isSelected()) {
DDRStepModule.loadModule();
} else {
DDRStepModule.unloadModule();
}
}
}
});
ddrstepBox.setVisible(true);
rabiraceBox.setActionCommand("rabirace");
rabiraceBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("rabirace")) {
if (ModuleSelector.rabiraceBox.isSelected()) {
RabiRaceModule.loadModule();
} else {
RabiRaceModule.unloadModule();
}
}
}
});
rabiraceBox.setVisible(true);
rabiribiBox.setActionCommand("rabiribi");
rabiribiBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("rabiribi")) {
if (ModuleSelector.rabiribiBox.isSelected()) {
RabiRibiModule.loadModule();
} else {
RabiRibiModule.unloadModule();
}
}
}
});
rabiribiBox.setVisible(true);
controllerBox.setActionCommand("controller");
controllerBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("controller")) {
if (ModuleSelector.controllerBox.isSelected()) {
ControllerModule.loadModule();
} else {
ControllerModule.unloadModule();
}
}
}
});
controllerBox.setVisible(true);
chatlogBox.setActionCommand("chatlog");
chatlogBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("chatlog")) {
if (ModuleSelector.chatlogBox.isSelected()) {
ChatLogModule.loadModule();
} else {
ChatLogModule.unloadModule();
}
}
}
});
chatlogBox.setVisible(true);
twitchBox.setActionCommand("twitch");
twitchBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("twitch")) {
if (ModuleSelector.twitchBox.isSelected()) {
TwitchModule.loadModule();
} else {
TwitchModule.unloadModule();
}
}
}
});
twitchBox.setVisible(true);
touhoumotherBox.setActionCommand("touhoumother");
touhoumotherBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent ev) {
if (ev.getActionCommand().equalsIgnoreCase("touhoumother")) {
if (ModuleSelector.touhoumotherBox.isSelected()) {
TouhouMotherModule.loadModule();
} else {
TouhouMotherModule.unloadModule();
}
}
}
});
touhoumotherBox.setVisible(true);
panel.setVisible(true);
panel.add(twitchBox);
panel.add(chatlogBox);
panel.add(controllerBox);
panel.add(rabiraceBox);
panel.add(bandoriBox);
panel.add(touhoumotherBox);
panel.add(ddrstepBox);
panel.add(rabiribiBox);
panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS));
this.add(panel);
this.pack();
this.setVisible(true);
this.repaint();
}
@Override
public void windowOpened(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosing(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowClosed(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowIconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeiconified(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowActivated(WindowEvent e) {
// TODO Auto-generated method stub
}
@Override
public void windowDeactivated(WindowEvent e) {
// TODO Auto-generated method stub
}
}

@ -0,0 +1,50 @@
package sig;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import javax.imageio.ImageIO;
import sig.sigIRC;
import sig.modules.TouhouMotherModule;
import sig.utils.DrawUtils;
import sig.utils.FileUtils;
import sig.utils.TextUtils;
public class ModuleSelectorButton {
BufferedImage buttonimg;
int x=0;
int y=0;
boolean buttonEnabled = true;
public ModuleSelectorButton(File filename, int x, int y) {
this.x=x;
this.y=y;
try {
buttonimg = ImageIO.read(filename);
} catch (IOException e) {
e.printStackTrace();
}
}
public void draw(Graphics g) {
if (buttonEnabled) {
g.drawImage(buttonimg, x, y, sigIRC.panel);
}
}
public void onClickEvent(MouseEvent ev) {
if (buttonEnabled && !sigIRC.overlayMode) {
if (ev.getX()>=x && ev.getX()<=x+buttonimg.getWidth() &&
ev.getY()>=y && ev.getY()<=y+buttonimg.getHeight()) {
sigIRC.moduleSelectorWindow.setVisible(true);
}
}
}
}

@ -34,7 +34,9 @@ import javax.swing.JPopupMenu;
import sig.modules.BandoriModule;
import sig.modules.ChatLogModule;
import sig.modules.ChatLog.ChatLogMessage;
import sig.utils.DrawUtils;
import sig.utils.FileUtils;
import sig.utils.TextUtils;
public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{
//List<String> messages = new ArrayList<String>();
@ -95,6 +97,11 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
sigIRC.chatlogtwitchemoticons.get(i).draw(g);
}
}
if (sigIRC.newUpdateIsAvailable) {
DrawUtils.drawOutlineText(g, MyPanel.programFont, sigIRC.panel.getWidth()
- TextUtils.calculateStringBoundsFont("NEW UPDATE AVAILABLE!!",MyPanel.programFont).getWidth(), sigIRC.panel.getHeight()
- TextUtils.calculateStringBoundsFont("NEW UPDATE AVAILABLE!!",MyPanel.programFont).getHeight(), 2, Color.RED, Color.WHITE, "NEW UPDATE AVAILABLE!!");
}
for (int i=0;i<sigIRC.textobj.size();i++) {
if (sigIRC.textobj.get(i).isActive()) {
if (sigIRC.overlayMode) {
@ -120,6 +127,7 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
}
if (!sigIRC.overlayMode) {
sigIRC.button.draw(g);
sigIRC.modulebutton.draw(g);
}
}
@ -148,6 +156,7 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
m.mouseModuleMousePress(ev);
}
sigIRC.button.onClickEvent(ev);
sigIRC.modulebutton.onClickEvent(ev);
}
@Override
@ -213,8 +222,10 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
sigIRC.config.setInteger("windowY", sigIRC.windowY);
sigIRC.config.setInteger("windowWidth", sigIRC.windowWidth);
sigIRC.config.setInteger("windowHeight", sigIRC.windowHeight);
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
sigIRC.button.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-192;
sigIRC.button.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
sigIRC.modulebutton.x = sigIRC.panel.getX()+sigIRC.panel.getWidth()-96;
sigIRC.modulebutton.y = 64+sigIRC.rowobj.size()*sigIRC.rowSpacing;
//com.repaint();
//sigIRC.panel.repaint();
sigIRC.config.saveProperties();

@ -2,6 +2,7 @@ package sig.modules;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.awt.geom.Rectangle2D;
@ -231,6 +232,22 @@ public class BandoriModule extends Module{
}
}
public static void loadModule() {
sigIRC.modules.add(new BandoriModule(
new Rectangle(sigIRC.bandorimodule_X,sigIRC.bandorimodule_Y,sigIRC.bandorimodule_width,sigIRC.bandorimodule_height),
"Bandori"
));
sigIRC.bandorimodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof BandoriModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.bandorimodule_enabled=false;
}
public BufferedImage crop(BufferedImage img, int x, int y, int targetWidth, int targetHeight) throws IOException {
int height = img.getHeight();
int width = img.getWidth();

@ -2,6 +2,7 @@ package sig.modules;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.geom.Rectangle2D;
@ -51,6 +52,22 @@ public class ChatLogModule extends Module{
}
}
public static void loadModule() {
sigIRC.modules.add(new ChatLogModule(
new Rectangle(sigIRC.chatlogmodule_X,sigIRC.chatlogmodule_Y,sigIRC.chatlogmodule_width,sigIRC.chatlogmodule_height),
"Chat Log"
));
sigIRC.chatlogmodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof ChatLogModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.chatlogmodule_enabled=false;
}
public void run() {
super.run();
if (delay>0 && sigIRC.subEmotesCompleted) {

@ -110,6 +110,22 @@ public class ControllerModule extends Module{
}
}
public static void loadModule() {
sigIRC.modules.add(new ControllerModule(
new Rectangle(sigIRC.controllermodule_X,sigIRC.controllermodule_Y,sigIRC.controllermodule_width,sigIRC.controllermodule_height),
"Controller"
));
sigIRC.controllermodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof ControllerModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.controllermodule_enabled=false;
}
public List<Controller> getControllers() {
return controllers;
}

@ -4,6 +4,7 @@ import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.geom.Rectangle2D;
import java.io.File;
@ -82,6 +83,22 @@ public class DDRStepModule extends Module{
}
}
public static void loadModule() {
sigIRC.modules.add(new DDRStepModule(
new Rectangle(sigIRC.ddrstepmodule_X,sigIRC.ddrstepmodule_Y,sigIRC.ddrstepmodule_width,sigIRC.ddrstepmodule_height),
"DDR Step"
));
sigIRC.ddrstepmodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof DDRStepModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.ddrstepmodule_enabled=false;
}
public void run() {
super.run();

@ -189,6 +189,22 @@ public class RabiRaceModule extends Module{
create_button = new CreateButton(new Rectangle(122,(int)(position.getHeight()-18),120,18),"Create Session",this);
markmap_button = new MarkMapButton(new Rectangle(2,(int)(position.getHeight()-42),120,18),"Mark Map",this);
}
public static void loadModule() {
sigIRC.modules.add(new RabiRaceModule(
new Rectangle(sigIRC.rabiracemodule_X,sigIRC.rabiracemodule_Y,sigIRC.rabiracemodule_width,sigIRC.rabiracemodule_height),
"Rabi Race"
));
sigIRC.rabiracemodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof RabiRaceModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.rabiracemodule_enabled=false;
}
private void RunRabiRaceUpdater() {
if (foundRabiRibi) {

@ -3,6 +3,7 @@ package sig.modules;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
@ -129,6 +130,22 @@ public class RabiRibiModule extends Module{
}, 1000, 1000, TimeUnit.MILLISECONDS);
}
public static void loadModule() {
sigIRC.modules.add(new RabiRibiModule(
new Rectangle(sigIRC.rabiribimodule_X,sigIRC.rabiribimodule_Y,sigIRC.rabiribimodule_width,sigIRC.rabiribimodule_height),
"Rabi Ribi"
));
sigIRC.rabiribimodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof RabiRibiModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.rabiribimodule_enabled=false;
}
public void ApplyConfigWindowProperties() {
sigIRC.rabiribimodule_X=(int)position.getX();
sigIRC.rabiribimodule_Y=(int)position.getY();

@ -113,6 +113,22 @@ public class TouhouMotherModule extends Module implements ActionListener{
CheckTouhouMotherClient();
}, 5000, 5000, TimeUnit.MILLISECONDS);
}
public static void loadModule() {
sigIRC.modules.add(new TouhouMotherModule(
new Rectangle(sigIRC.touhoumothermodule_X,sigIRC.touhoumothermodule_Y,sigIRC.touhoumothermodule_width,sigIRC.touhoumothermodule_height),
"Touhou Mother"
));
sigIRC.touhoumothermodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof TouhouMotherModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
sigIRC.touhoumothermodule_enabled=false;
}
private void CheckTouhouMotherClient() {
List<Integer> pids;

@ -1,9 +1,6 @@
package sig.modules.Twitch;
import java.io.File;
import java.text.DateFormat;
import com.mb3364.twitch.api.models.User;
import sig.modules.TwitchModule;
import sig.utils.FileUtils;
@ -18,13 +15,13 @@ public class Announcement {
int i=0;
String[] contents = FileUtils.readFromFile(userFilePath);
userData = new Follower(twitchID,
contents[i++],
"",
contents[i++],
contents[i++],
contents[i++],
contents[i++],
"");
contents[1],
contents[0],
contents[2],
contents[3],
contents[4],
contents[5],
contents[6]);
} else {
System.out.println("WARNING! Could not find user with ID "+twitchID+"!");
}

@ -1,14 +1,14 @@
package sig.modules.Twitch;
public class Follower {
long id;
String bio;
String created_at;
String display_name;
String logo_url;
String name;
String type;
String updated_at;
public long id;
public String bio;
public String created_at;
public String display_name;
public String logo_url;
public String name;
public String type;
public String updated_at;
Follower(Long id,
String bio,
String created_at,
@ -26,7 +26,7 @@ public class Follower {
this.type = type;
this.updated_at = updated_at;
}
Follower(String id,
public Follower(String id,
String bio,
String created_at,
String display_name,

@ -12,6 +12,8 @@ import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.DateFormat;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@ -29,6 +31,7 @@ import sig.Module;
import sig.sigIRC;
import sig.modules.Twitch.Announcement;
import sig.modules.Twitch.FancyNumber;
import sig.modules.Twitch.Follower;
import sig.utils.DrawUtils;
import sig.utils.FileUtils;
import sig.utils.SoundUtils;
@ -53,7 +56,7 @@ public class TwitchModule extends Module{
FancyNumber viewers_numb;
FancyNumber followers_numb;
FancyNumber views_numb;
Date uptime = Calendar.getInstance().getTime();
ZonedDateTime uptime;
String currentlyPlaying=" ";
final public static int ARROWTIMER = 3000;
public static BufferedImage UPARROWIMAGE;
@ -79,8 +82,10 @@ public class TwitchModule extends Module{
if (firstTime) {
CreateFollowerQueueLog();
}
ClearFollowerAnnouncerQueue();
myTwitchChannelID = getMyChannelID();
//myTwitchChannelID = getMyChannelID();
/*manager.streams().get("theduckishot", new StreamResponseHandler() {
@ -129,17 +134,20 @@ public class TwitchModule extends Module{
});*/
}
private long getMyChannelID() {
Long id = -1l;
try {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+sigIRC.nickname, "temp_connect");
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
JSONArray a = j.getJSONArray("users");
id = Long.parseLong(a.getJSONObject(0).getString("_id"));
} catch (JSONException | IOException e) {
e.printStackTrace();
public static void loadModule() {
sigIRC.modules.add(new TwitchModule(
new Rectangle(sigIRC.twitchmodule_X,sigIRC.twitchmodule_Y,sigIRC.twitchmodule_width,sigIRC.twitchmodule_height),
"Twitch"
));
sigIRC.twitchmodule_enabled=true;
}
public static void unloadModule() {
for (int i=0;i<sigIRC.modules.size();i++) {
if (sigIRC.modules.get(i) instanceof TwitchModule) {
sigIRC.modules.remove(sigIRC.modules.get(i));
}
}
return id;
sigIRC.twitchmodule_enabled=false;
}
private void InitializeFollowerSounds() {
@ -171,16 +179,54 @@ public class TwitchModule extends Module{
public void run() {
if (lastFollowerCheck--<=0) {
lastFollowerCheck = FOLLOWERCHECKTIMER;
getFollowers(false);
//getFollowers(false);
try {
GetFollowerAndStreamData();
} catch (IOException e1) {
e1.printStackTrace();
}
popFollowerFromQueue();
try {
//System.out.println("Checking Followers...");
JSONObject FollowerData = GetFollowerAndStreamData();
followers_numb.updateValue(FollowerData.getInt("total"));
//views_numb.updateValue(FollowerData.get);
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
// isStreamOnline(true);
///TODO Rewrite.
}
if (lastFollowerAnnouncement>0) {
lastFollowerAnnouncement--;
}
//System.out.println(lastFollowerCheck);
}
public JSONObject GetFollowerAndStreamData() throws IOException {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/streams?user_id="+sigIRC.channel_id, "stream_info",true);
JSONObject streamInfo = FileUtils.readJsonFromFile("stream_info");
JSONArray streamData = streamInfo.getJSONArray("data");
JSONObject stream = streamData.getJSONObject(0);
streamOnline = streamData.length()!=0;
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter
.ofPattern("uuuu-MM-dd'T'HH:mm:ssz");
uptime = ZonedDateTime.parse(stream.getString("started_at"),DATE_TIME_FORMATTER);
viewers_numb.updateValue(stream.getInt("viewer_count"));
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users/follows?to_id="+sigIRC.channel_id, "temp_followers",true);
JSONObject FollowerData = FileUtils.readJsonFromFile("temp_followers");
JSONArray data = FollowerData.getJSONArray("data");
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users?id="+sigIRC.channel_id, "channel_info",true);
JSONObject channelData = FileUtils.readJsonFromFile("channel_info").getJSONArray("data").getJSONObject(0);
views_numb.updateValue(channelData.getInt("view_count"));
for (int i=0;i<data.length();i++) {
JSONObject user = data.getJSONObject(i);
addFollower(user.getString("from_name"),user.getLong("from_id"),streamOnline,false);
}
return FollowerData;
}
public void ApplyConfigWindowProperties() {
sigIRC.twitchmodule_X=(int)position.getX();
@ -190,31 +236,31 @@ public class TwitchModule extends Module{
}
private void popFollowerFromQueue() {
//TODO REWRITE.
if (sigIRC.testMode) {
/*User user = new User();
user.setDisplayName("Test User"+((int)Math.random()*100000));
user.setBio("I am an awesome test subject.");
user.setName(user.getDisplayName());
user.setLogo("http://45.33.13.215/sigIRCv2/sigIRC/sigIRCicon.png");
DisplayFollowerAnnouncement(user,true);*/
Follower user = new Follower("0","I am an awesome test subject.",
new Date().toString(),
"Test User"+((int)Math.random()*100000),
"http://45.33.13.215/sigIRCv2/sigIRC/sigIRCicon.png",
"Test User",
"",
new Date().toString());
DisplayFollowerAnnouncement(user,true);
} else
if (follower_queue.size()>0) {
///TODO Rewrite.
// if (isStreamOnline()) {
// //We have a follower to announce!
// /*Announcement a = follower_queue.remove(0);
// User user = a.getUser();
// if (user.getDisplayName().length()>0 &&
// !user.getDisplayName().contains("?")) {
// DisplayFollowerAnnouncement(user,true);
// } else {
// DisplayFollowerAnnouncement(user,false);
// }*/
// } else {
// //Store away all remaining followers in the queue....We can't announce them right now.
// StoreRemainingFollowers();
// }
if (streamOnline) {
//We have a follower to announce!
Announcement a = follower_queue.remove(0);
Follower user = a.getUser();
if (user.display_name.length()>0 &&
!user.display_name.contains("?")) {
DisplayFollowerAnnouncement(user,true);
} else {
DisplayFollowerAnnouncement(user,false);
}
} else {
//Store away all remaining followers in the queue....We can't announce them right now.
StoreRemainingFollowers();
}
}
}
@ -224,25 +270,25 @@ public class TwitchModule extends Module{
private void StoreRemainingFollowers() {
for (Announcement a : follower_queue) {
//FileUtils.logToFile(Long.toString(a.getUser().getId()), FOLLOWERQUEUEFILE);
//TODO REWRITE
FileUtils.logToFile(Long.toString(a.getUser().id), FOLLOWERQUEUEFILE);
}
follower_queue.clear();
}
//TODO REWRITE
/*private void DisplayFollowerAnnouncement(User user, boolean useNickname) {
public static Follower announcedFollowerUser;
private void DisplayFollowerAnnouncement(Follower user, boolean useNickname) {
lastFollowerAnnouncement = FOLLOWERANNOUNCEMENTTIME;
if (!useNickname) {
user.setDisplayName(user.getName());
user.display_name=user.name;
}
announcedFollowerUser = user;
String followerAnnouncement = user.getDisplayName()+" is now following the stream!";
String userlogo = USERDIR+user.getId()+"_logo";
if (user.getLogo()!=null && !user.getLogo().equalsIgnoreCase("null")) {
String followerAnnouncement = user.display_name+" is now following the stream!";
String userlogo = USERDIR+user.id+"_logo";
if (user.logo_url!=null && !user.logo_url.equalsIgnoreCase("null")) {
try {
org.apache.commons.io.FileUtils.copyURLToFile(new URL(user.getLogo()),new File(userlogo));
org.apache.commons.io.FileUtils.copyURLToFile(new URL(user.logo_url),new File(userlogo));
File logo = new File(userlogo);
if (logo.exists()) {
followerUserLogo = ImageIO.read(logo);
@ -260,7 +306,7 @@ public class TwitchModule extends Module{
LogMessageToFile(followerAnnouncement);
System.out.println(followerAnnouncement);
SoundUtils.playSound(SOUNDSDIR+followersounds[(int)(Math.random()*followersounds.length)]);
}*/
}
private void InitializeImages() {
try {
@ -286,44 +332,7 @@ public class TwitchModule extends Module{
}
}
}
private void getFollowers(boolean firstTime) {
try {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/channels/"+myTwitchChannelID+"/follows", "follows");
JSONObject o = FileUtils.readJsonFromFile("follows");
JSONArray data = o.getJSONArray("follows");
for (int i=0;i<data.length();i++) {
}
} catch (JSONException | IOException e) {
e.printStackTrace();
}
///TODO Rewrite.
/*sigIRC.manager.channels().getFollows(TextUtils.getActualChannelName(), new ChannelFollowsResponseHandler() {
@Override
public void onSuccess(int total, java.util.List<ChannelFollow> follows) {
//System.out.println("Successfully found followers for channel "+sigIRC.channel+". Total: "+total);
//console = "Last Follower: "+follows.get(0).getUser().getDisplayName();
for (ChannelFollow f : follows) {
addFollower(f,isStreamOnline(),firstTime);
}
}
@Override
public void onFailure(Throwable arg0) {
}
@Override
public void onFailure(int arg0, String arg1, String arg2) {
System.out.println(arg0+","+arg1+","+arg2);
}
}
);
if (isStreamOnline()) {ClearFollowerAnnouncerQueue();}*/
}
private void ClearFollowerAnnouncerQueue() {
String[] contents = FileUtils.readFromFile(FOLLOWERQUEUEFILE);
//System.out.println("Contents: "+Arrays.toString(contents));
@ -335,101 +344,50 @@ public class TwitchModule extends Module{
}
}
}
// private boolean isStreamOnline() {
///TODO Rewrite.
// return isStreamOnline(false);
// }
///TODO Rewrite.
/*private boolean isStreamOnline(boolean update) {
if (update) {
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;
}
@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);
}
}
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());
}
protected void addFollower(String username, long id, boolean streamOnline, boolean silent) {
String filename = USERDIR + Long.toString(id);
File userProfile = new File(filename);
if (!userProfile.exists()) {
CreateUserProfile(username, id, filename, userProfile);
if (!silent) { //If we got in here, this isn't the initial follower setup, so we are good to go with announcing these followers.
if (!streamOnline) {
//Save their ID to a queue.
FileUtils.logToFile(Long.toString(id), FOLLOWERQUEUEFILE);
} else {
//Announce it now.
//System.out.println("Stream is online...");
AnnounceFollower(username,id);
}
});
return TwitchModule.streamOnline;
} else {
return TwitchModule.streamOnline;
}
}
//TwitchModule.streamOnline=true;
//return true;
}*/
// protected void addFollower(ChannelFollow f, boolean streamOnline, boolean silent) {
// String filename = USERDIR+f.getUser().getId();
// File userProfile = new File(filename);
// if (!userProfile.exists()) {
// if (!silent) { //If we got in here, this isn't the initial follower setup, so we are good to go with announcing these followers.
// if (!streamOnline) {
// //Save their ID to a queue.
// FileUtils.logToFile(Long.toString(f.getUser().getId()), FOLLOWERQUEUEFILE);
// } else {
// //Announce it now.
// //System.out.println("Stream is online...");
// AnnounceFollower(f);
// }
// }
// CreateUserProfile(f, filename, userProfile);
// }
// }
//
// private void CreateUserProfile(ChannelFollow f, String filename, File userProfile) {
// try {
// userProfile.createNewFile();
// FileUtils.logToFile(DateFormat.getDateInstance().format(f.getCreatedAt()), filename);
// FileUtils.logToFile(f.getUser().getBio(), filename);
// FileUtils.logToFile(f.getUser().getDisplayName(), filename);
// FileUtils.logToFile(f.getUser().getLogo(), filename);
// FileUtils.logToFile(f.getUser().getName(), filename);
// FileUtils.logToFile(f.getUser().getType(), filename);
// FileUtils.logToFile(DateFormat.getDateInstance().format(f.getUser().getUpdatedAt()), filename);
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// private void AnnounceFollower(ChannelFollow f) {
// //System.out.println("Thanks for following "+f.getUser().getDisplayName()+"!");
// AddFollowerToQueue(f.getUser());
// }
}
private void CreateUserProfile(String username, long id, String filename, File userProfile) {
try {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/helix/users?id="+id, "user_info",true);
System.out.println("File data: "+Arrays.toString(FileUtils.readFromFile("user_info")));
JSONObject userdata = FileUtils.readJsonFromFile("user_info").getJSONArray("data").getJSONObject(0);
userProfile.createNewFile();
System.out.println("Profile Image URL: "+userdata.getString("profile_image_url"));
FileUtils.logToFile(new Date().toString(), filename);
FileUtils.logToFile(userdata.getString("description"), filename);
FileUtils.logToFile(username, filename);
FileUtils.logToFile(userdata.getString("profile_image_url"), filename);
FileUtils.logToFile(userdata.getString("login"), filename);
FileUtils.logToFile(userdata.getString("type"), filename);
FileUtils.logToFile(new Date().toString(), filename);
} catch (IOException e) {
e.printStackTrace();
}
}
private void AnnounceFollower(String name,long id) {
System.out.println("Thanks for following "+name+"!");
AddFollowerToQueue(id);
}
private void AddFollowerToQueue(int id) {
private void AddFollowerToQueue(long id) {
follower_queue.add(new Announcement(id));
}
@ -482,7 +440,7 @@ public class TwitchModule extends Module{
int xoffset = 0;
int yoffset = 0;
g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth()+4;
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(uptime);
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(Date.from(uptime.toInstant()));
if (timediff.length()>0) {
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12;
}
@ -514,25 +472,25 @@ public class TwitchModule extends Module{
//g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel)
g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth()+canvasXOffset, (int)position.getY()+follower_img.getHeight(),
-xAlteration, 0, follower_img.getWidth(), follower_img.getHeight()-yAlteration, sigIRC.panel);
// Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.panel.programFont);
// int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
// int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
// if (textY<position.getY()+position.getHeight() && textX+usernameTextsize.getWidth()>position.getX()) {
// DrawUtils.drawCenteredText(g, sigIRC.panel.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.getDisplayName());
// }
// if (announcedFollowerUser.getBio()!=null && !announcedFollowerUser.getBio().equalsIgnoreCase("null")) {
// if (followerUserLogo!=null) {
// final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize;
// int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4));
// int img_starty = (int)(position.getY()+follower_img.getHeight()+2-image_size/2);
// //g.setColor(Color.BLACK);
// //g.drawRect(img_startx, img_starty, image_size, image_size);
// g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
// }
// if (announcedFollowerUser.getBio()!=null && announcedFollowerUser.getBio().length()>0) {
// DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio());
// }
// }
Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.display_name, sigIRC.panel.programFont);
int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
if (textY<position.getY()+position.getHeight() && textX+usernameTextsize.getWidth()>position.getX()) {
DrawUtils.drawCenteredText(g, sigIRC.panel.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.display_name);
}
if (announcedFollowerUser.bio!=null && !announcedFollowerUser.bio.equalsIgnoreCase("null")) {
if (followerUserLogo!=null) {
final int image_size = sigIRC.twitchmodule_newfollowerImgLogoSize;
int img_startx = (int)(position.getX()+position.getWidth()-ticksPassed*3-(image_size+4));
int img_starty = (int)(position.getY()+follower_img.getHeight()+2-image_size/2);
g.setColor(Color.BLACK);
g.drawRect(img_startx, img_starty, image_size, image_size);
g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
}
if (announcedFollowerUser.bio!=null && announcedFollowerUser.bio.length()>0) {
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.bio);
}
}
}
}
}

@ -26,6 +26,7 @@ import sig.modules.TouhouMotherModule;
import sig.modules.TwitchModule;
import sig.modules.ChatLog.ChatLogMessage;
import sig.modules.ChatLog.ChatLogTwitchEmote;
import sig.modules.Controller.ControlConfigurationWindow;
import sig.modules.utils.MyKernel32;
import sig.modules.utils.PsapiTools;
import sig.utils.FileUtils;
@ -52,12 +53,14 @@ import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.SocketException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.TimerTask;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
@ -92,6 +95,7 @@ public class sigIRC{
static int dingThreshold;
static Color backgroundcol;
public static BackgroundColorButton button;
public static ModuleSelectorButton modulebutton;
public static JFrame window;
static boolean overlayMode=false;
public static boolean showWindowControls=false;
@ -108,8 +112,8 @@ public class sigIRC{
static Integer messageFontSize = 24;
static Integer usernameFontSize = 16;
static Integer touhoumotherConsoleFontSize = 12;
static boolean touhoumothermodule_enabled=false;
static boolean twitchmodule_enabled=true;
public static boolean touhoumothermodule_enabled=false;
public static boolean twitchmodule_enabled=true;
public static boolean chatlogmodule_enabled=true;
static boolean downloadsComplete=false;
static boolean hardwareAcceleration=true;
@ -168,9 +172,12 @@ public class sigIRC{
public static int lastSubEmoteUpdate = -1;
public static boolean autoUpdateProgram = true;
public static Image programIcon;
final public static int MAX_CONNECTION_RETRIES = 100;
public final static String CLIENTID = "b5d94i1pu4pq6egyc43xil4p3ujh8t";
//final public static int MAX_CONNECTION_RETRIES = 100;
public static String CLIENTID = "";
public static int retryCounter = 0;
public static boolean newUpdateIsAvailable = false;
public static long lastRetryTime = 0l;
public static List<ModuleLinker> moduleList;
public static int subchannelCount = 0;
public static HashMap<Long,String> subchannelIds = new HashMap<Long,String>();
@ -182,13 +189,40 @@ public class sigIRC{
static int lastWindowX = 0;
static int lastWindowY = 0;
public static String longString = "10988989d";
public static ModuleSelector moduleSelectorWindow;
public static String oauth;
public static void main(String[] args) {
String[] filedata = FileUtils.readFromFile(BASEDIR+"sigIRC/oauthToken.txt");
oauth = filedata[0];
//filedata = FileUtils.readFromFile("user_data");
JSONObject data;
try {
FileUtils.downloadFileFromUrl("https://id.twitch.tv/oauth2/validate", "user_data");
data = FileUtils.readJsonFromFile("user_data");
sigIRC.CLIENTID = data.getString("client_id");
} catch (JSONException | IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
config = InitializeConfigurationFile();
server = config.getProperty("server");
nickname = config.getProperty("nickname");
channel = config.getProperty("channel");
try {
channel_id = sigIRC.GetChannelID(channel.replace("#", ""));
} catch (IOException e) {
e.printStackTrace();
}
overlayMode = config.getBoolean("overlayMode", false);
showWindowControls = config.getBoolean("showWindowControls", true);
windowX = config.getInteger("windowX", 0);
@ -271,10 +305,6 @@ public class sigIRC{
e.printStackTrace();
}*/
String[] filedata = FileUtils.readFromFile(BASEDIR+"sigIRC/oauthToken.txt");
final String oauth = filedata[0];
Initialize();
WriteBreakToLogFile();
@ -355,6 +385,7 @@ public class sigIRC{
manager = new FileManager("swap.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("modules.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("map_icons.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("sigIRC/stamps1.png"); manager.verifyAndFetchFileFromServer();
@ -386,10 +417,10 @@ public class sigIRC{
} catch (IOException e) {
e.printStackTrace();
}
newUpdateIsAvailable = true;
}
}
}
private static void InitializeModules() {
try {
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png"));
@ -434,10 +465,7 @@ public class sigIRC{
));
}
if (bandorimodule_enabled) {
modules.add(new BandoriModule(
new Rectangle(bandorimodule_X,bandorimodule_Y,bandorimodule_width,bandorimodule_height),
"Bandori"
));
BandoriModule.loadModule();
}
if (ddrstepmodule_enabled) {
modules.add(new DDRStepModule(
@ -445,6 +473,7 @@ public class sigIRC{
"DDR Step"
));
}
moduleSelectorWindow = new ModuleSelector();
}
private static void InitializeCustomSounds() {
@ -473,17 +502,18 @@ public class sigIRC{
writer.flush();
runIRCLoop(channel, writer, reader);
}
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (UnknownHostException | SocketException e) {
//e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (retryCounter<MAX_CONNECTION_RETRIES) {
InitializeIRCConnection(server,nickname,channel,oauth);
} else {
sigIRC.panel.addMessage("Connection timed out. Please restart and try again.");
System.out.println("Connection timed out. Please restart and try again.");
}
new java.util.Timer().schedule(new TimerTask() {
public void run() {
InitializeIRCConnection(server,nickname,channel,oauth);
sigIRC.panel.addMessage("SYSTEM: Lost connection. Trying to reconnect...");
System.out.println("SYSTEM: Lost connection. Trying to reconnect...");
}
},10000);
}
public static void WriteBreakToLogFile() {
@ -497,10 +527,7 @@ public class sigIRC{
private static void getSubChannels(String s) {
try {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+s, "temp_connect");
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
JSONArray a = j.getJSONArray("users");
Long id = Long.parseLong(a.getJSONObject(0).getString("_id"));
Long id = GetChannelID(s);
subchannelIds.put(id, s);
//System.out.println("Got ID "+id+" for channel "+s);
} catch (JSONException | IOException e) {
@ -509,6 +536,14 @@ public class sigIRC{
//TwitchModule.streamOnline=true;
}
public static Long GetChannelID(String username) throws IOException {
FileUtils.downloadFileFromUrl("https://api.twitch.tv/kraken/users?login="+username, "temp_connect");
JSONObject j = FileUtils.readJsonFromFile("temp_connect");
JSONArray a = j.getJSONArray("users");
Long id = Long.parseLong(a.getJSONObject(0).getString("_id"));
return id;
}
/*private static void getSubChannels(String channelName) {
manager.channels().get(channelName, new ChannelResponseHandler() {
@Override
@ -710,6 +745,7 @@ public class sigIRC{
f.setIconImage(programIcon);
button = new BackgroundColorButton(new File(sigIRC.BASEDIR+"backcolor.png"),panel.getX()+panel.getWidth()-96,64+rowobj.size()*rowSpacing);
modulebutton = new ModuleSelectorButton(new File(sigIRC.BASEDIR+"modules.png"),panel.getX()+panel.getWidth()-96,64+rowobj.size()*rowSpacing);
if (sigIRC.overlayMode) {
f.setBackground(new Color(0,0,0,0));
f.setAlwaysOnTop(true);

@ -242,9 +242,10 @@ public class FileUtils {
}
public static void logToFile(String message, String filename) {
if (filename.equalsIgnoreCase("debug.log") && RabiRaceModule.DEBUGMODE==1
if ((!filename.equalsIgnoreCase("debug.log") &&
!filename.equalsIgnoreCase("debug2.log")) || (filename.equalsIgnoreCase("debug.log") && RabiRaceModule.DEBUGMODE==1)
||
filename.equalsIgnoreCase("debug2.log") && RabiRaceModule.DEBUGMODE==2
(filename.equalsIgnoreCase("debug2.log") && RabiRaceModule.DEBUGMODE==2)
) {
logToFile(message,filename,false);
}
@ -314,8 +315,7 @@ public class FileUtils {
}
public static void downloadFileFromUrl(String url, String file) throws IOException, JSONException {
public static void downloadFileFromUrl(String url, String file,boolean bearer) throws IOException, JSONException {
File filer = new File(file);
filer.createNewFile();
@ -327,7 +327,11 @@ public class FileUtils {
connection.setRequestMethod("GET");
//connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Accept", "application/vnd.twitchtv.v5+json");
connection.setRequestProperty("Client-ID", sigIRC.CLIENTID);
connection.setRequestProperty("Authorization", ((bearer)?"Bearer":"OAuth") + " "+sigIRC.oauth.replace("oauth:", ""));
if (sigIRC.CLIENTID.length()!=0) {
connection.setRequestProperty("Client-ID", sigIRC.CLIENTID);
//System.out.println("Using "+ sigIRC.oauth+"/"+sigIRC.CLIENTID);
}
try {
ReadableByteChannel rbc = Channels.newChannel(connection.getInputStream());
FileOutputStream fos = new FileOutputStream(file);
@ -337,4 +341,8 @@ public class FileUtils {
System.out.println("Failed to connect, moving on...");
}
}
public static void downloadFileFromUrl(String url, String file) throws IOException, JSONException {
downloadFileFromUrl(url,file,false); //Uses OAUTH instead of Bearer
}
}

Loading…
Cancel
Save