From d6cad9ef9675458ceac7a75c60644894844e1803 Mon Sep 17 00:00:00 2001 From: KonoTyran Date: Tue, 1 Dec 2020 23:44:41 -0800 Subject: [PATCH 1/2] netbeans is being dumb with caseing on filenames --- .../leaguerestreamtool/mainwindow.form | 170 ------------------ 1 file changed, 170 deletions(-) delete mode 100644 src/main/java/me/konotyran/leaguerestreamtool/mainwindow.form diff --git a/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.form b/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.form deleted file mode 100644 index d74cda0..0000000 --- a/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.form +++ /dev/null @@ -1,170 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
From be43541ff5abd8b7bdaf30b234be256dabd5fc54 Mon Sep 17 00:00:00 2001 From: KonoTyran Date: Tue, 1 Dec 2020 23:45:06 -0800 Subject: [PATCH 2/2] more netbeans being dumb with file casings --- .../leaguerestreamtool/mainwindow.java | 345 ------------------ 1 file changed, 345 deletions(-) delete mode 100644 src/main/java/me/konotyran/leaguerestreamtool/mainwindow.java diff --git a/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.java b/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.java deleted file mode 100644 index 861e400..0000000 --- a/src/main/java/me/konotyran/leaguerestreamtool/mainwindow.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ -package me.konotyran.leaguerestreamtool; - -import java.io.FileWriter; -import java.util.List; -import java.io.IOException; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.table.DefaultTableModel; -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; -import org.jsoup.nodes.Element; -import org.jsoup.select.Elements; - -/** - * - * @author HAklo - */ -public class mainwindow extends javax.swing.JFrame { - - List Table = new ArrayList(); - - /** - * Creates new form main window - */ - public mainwindow() { - initComponents(); - } - - /** - * This method is called from within the constructor to initialize the form. - * WARNING: Do NOT modify this code. The content of this method is always - * regenerated by the Form Editor. - */ - @SuppressWarnings("unchecked") - // //GEN-BEGIN:initComponents - private void initComponents() { - - buttonOpen = new javax.swing.JButton(); - buttonInv = new javax.swing.JButton(); - buttonSubmit = new javax.swing.JButton(); - jScrollPane1 = new javax.swing.JScrollPane(); - scheduleTable = new javax.swing.JTable(); - jPanel1 = new javax.swing.JPanel(); - Status = new javax.swing.JLabel(); - filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 17), new java.awt.Dimension(0, 17), new java.awt.Dimension(32767, 20)); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("aLttPR Leauge Restream Tool"); - - buttonOpen.setText("Open"); - buttonOpen.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonOpenActionPerformed(evt); - } - }); - - buttonInv.setText("Invitational"); - buttonInv.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonInvActionPerformed(evt); - } - }); - - buttonSubmit.setText("I Choose You!"); - buttonSubmit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - buttonSubmitActionPerformed(evt); - } - }); - - scheduleTable.setModel(new javax.swing.table.DefaultTableModel( - new Object [][] { - - }, - new String [] { - "Time", "Team 1", "Team 2", "Channel", "Comms", "Tracker", "Notes" - } - ) { - Class[] types = new Class [] { - java.lang.String.class, java.lang.Object.class, java.lang.Object.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class - }; - boolean[] canEdit = new boolean [] { - false, false, false, false, false, false, false - }; - - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - - public boolean isCellEditable(int rowIndex, int columnIndex) { - return canEdit [columnIndex]; - } - }); - scheduleTable.setToolTipText(""); - scheduleTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN); - scheduleTable.setRowHeight(35); - scheduleTable.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); - scheduleTable.getTableHeader().setReorderingAllowed(false); - jScrollPane1.setViewportView(scheduleTable); - - jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); - - Status.setToolTipText(""); - Status.setFocusable(false); - - javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); - jPanel1.setLayout(jPanel1Layout); - jPanel1Layout.setHorizontalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() - .addComponent(Status, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - ); - jPanel1Layout.setVerticalGroup( - jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(Status) - .addComponent(filler1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - ); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 914, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(buttonOpen) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(buttonInv) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonSubmit))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(buttonOpen) - .addComponent(buttonInv) - .addComponent(buttonSubmit)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - ); - - pack(); - }// //GEN-END:initComponents - - - private boolean WriteSchedule(String url) { - try { - DefaultTableModel dtm = (DefaultTableModel)scheduleTable.getModel(); - dtm.setRowCount(0); - Table.clear(); - Document doc = Jsoup.connect(url).get(); - doc.select("br").append(":::"); - - Element table = doc.getElementsByTag("table").get(0); //fetch table - Elements rows = table.getElementsByTag("tr"); //seperate out each line - rows.remove(0); //remove headder line 0 - int line = -1; - for (Element row : rows) { - ++line; - //get time - Elements cells = row.getElementsByTag("td"); - String time = cells.get(0).text(); - - //get teams and proccess them - String rawPlayerData = cells.get(1).text(); - String[] rawTeamData = rawPlayerData.split(":::"); - - String[] teams = {"", ""}; - if(!rawTeamData[0].isBlank()) { - teams = rawTeamData[0].split("_"); - } - - String[] playersraw = rawTeamData[1].split("vs"); - String[] playerleft = playersraw[0].split("and"); - String[] playerright = playersraw[1].split("and"); - - if (playerleft.length == 1) - playerleft = new String[]{playerleft[0],""}; - if (playerright.length == 1) - playerright = new String[]{playerright[0],""}; - - //get channel - String channel = cells.get(2).text(); - - //get commentators - cells.get(3).select("a").remove(); - String rawCommsData = cells.get(3).text(); - String comms = rawCommsData.split(":::")[0]; - - //get tracker - cells.get(4).select("a").remove(); - String rawTrackerData = cells.get(4).text(); - String tracker = rawTrackerData.split(":::")[0]; - - //get notes - String notes = cells.get(5).text(); - - Table.add(new String[]{time,teams[0],playerleft[0],playerleft[1],teams[1],playerright[0],playerright[1],channel,comms,tracker}); - - dtm.addRow(new String[]{time,""+teams[0]+"
"+playerleft[0]+" "+playerleft[1]+"",""+teams[1]+"
"+playerright[0]+" "+playerright[1]+"",channel,comms,tracker,notes}); - - } - Status.setText("done loading scheudle."); - return true; - } catch (IOException ex) { - Status.setText("error loading schedule from: "+url); - Logger.getLogger(mainwindow.class.getName()).log(Level.SEVERE, null, ex); - return false; - - } - } - - - private void buttonOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonOpenActionPerformed - // TODO add your handling code here: - Status.setText("Loading Open Schedule..."); - - - if(WriteSchedule("http://speedgaming.org/alttprleague/crew")) { - Status.setText("Done Loading Open Schedule."); - } - }//GEN-LAST:event_buttonOpenActionPerformed - - private void buttonSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSubmitActionPerformed - // TODO add your handling code here: - int row = scheduleTable.getSelectedRow(); - if(row == -1) { - Status.setText("no row selected"); - return; - } - Status.setText("Writing Row " + row + " to files..."); - // Table.add(new String[]{time,teams[0],playerleft[0],playerleft[1],teams[1],playerright[0],playerright[1],channel,comms,tracker}); - String[] line = Table.get(row); - try { - FileWriter time = new FileWriter("time.txt"); - time.write(line[0]); //write time line to file - time.close(); - - FileWriter lTeam = new FileWriter("left-team.txt"); - lTeam.write(line[1]); //write time line to file - lTeam.close(); - - FileWriter tlplayer = new FileWriter("top-left-player.txt"); - tlplayer.write(line[2]); //write time line to file - tlplayer.close(); - - FileWriter blplayer = new FileWriter("bottom-left-player.txt"); - blplayer.write(line[3]); //write time line to file - blplayer.close(); - - FileWriter rTeam = new FileWriter("right-team.txt"); - rTeam.write(line[4]); //write time line to file - rTeam.close(); - - FileWriter trplayer = new FileWriter("top-right-player.txt"); - trplayer.write(line[5]); //write time line to file - trplayer.close(); - - FileWriter brplayer = new FileWriter("bottom-right-player.txt"); - brplayer.write(line[6]); //write time line to file - brplayer.close(); - - FileWriter comms = new FileWriter("commentators.txt"); - comms.write(line[8]); //write time line to file - comms.close(); - - } catch (IOException ex) { - Status.setText("Error Writing Files"); - Logger.getLogger(mainwindow.class.getName()).log(Level.SEVERE, null, ex); - } - }//GEN-LAST:event_buttonSubmitActionPerformed - - private void buttonInvActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInvActionPerformed - // TODO add your handling code here: - Status.setText("Loading Invitational Schedule..."); - - if(WriteSchedule("http://schedule.speedgaming.org/invleague/crew/")) { - Status.setText("Done Loading Invitational Schedule."); - } - }//GEN-LAST:event_buttonInvActionPerformed - - /** - * @param args the command line arguments - */ - public static void main(String args[]) { - /* Set the Nimbus look and feel */ - // - /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. - * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html - */ - try { - for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { - if ("Nimbus".equals(info.getName())) { - javax.swing.UIManager.setLookAndFeel(info.getClassName()); - break; - } - } - } catch (ClassNotFoundException ex) { - java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(mainwindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - // - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - mainwindow gui = new mainwindow(); - gui.setVisible(true); - } - }); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JLabel Status; - private javax.swing.JButton buttonInv; - private javax.swing.JButton buttonOpen; - private javax.swing.JButton buttonSubmit; - private javax.swing.Box.Filler filler1; - private javax.swing.JPanel jPanel1; - private javax.swing.JScrollPane jScrollPane1; - private javax.swing.JTable scheduleTable; - // End of variables declaration//GEN-END:variables -}