From 0492a6b789d3a0a4bd82676140ef3d58cf7e687e Mon Sep 17 00:00:00 2001 From: Donald Shan Date: Sun, 21 Aug 2022 15:54:14 -0700 Subject: Preliminary Edit Tag Button --- .gitignore | 14 ++ .idea/.gitignore | 3 + ffmpeg.exe | Bin 0 -> 49592832 bytes pom.xml | 86 ++++++------ src/main/java/Main.java | 303 +++++++++++++++++++++++++++++++++++++++++++ src/main/java/TagEditor.java | 11 ++ youtube-dl.exe | Bin 0 -> 8170320 bytes 7 files changed, 374 insertions(+), 43 deletions(-) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 ffmpeg.exe create mode 100644 src/main/java/Main.java create mode 100644 src/main/java/TagEditor.java create mode 100644 youtube-dl.exe diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bd7c02e --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ + +*.mp3 + + +.idea/compiler.xml +.idea/encodings.xml +.idea/jarRepositories.xml +.idea/misc.xml +.idea/uiDesigner.xml +*.jar +*.lst +*.properties +*.class +*.json diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/ffmpeg.exe b/ffmpeg.exe new file mode 100644 index 0000000..e4e17f9 Binary files /dev/null and b/ffmpeg.exe differ diff --git a/pom.xml b/pom.xml index 9a69b7c..5de6c6b 100644 --- a/pom.xml +++ b/pom.xml @@ -50,48 +50,48 @@ - - - - - maven-clean-plugin - 3.1.0 - - - - maven-resources-plugin - 3.0.2 - - - maven-compiler-plugin - 3.8.0 - - - maven-surefire-plugin - 2.22.1 - - - maven-jar-plugin - 3.0.2 - - - maven-install-plugin - 2.5.2 - - - maven-deploy-plugin - 2.8.2 - - - - maven-site-plugin - 3.7.1 - - - maven-project-info-reports-plugin - 3.0.0 - - - + clean package + + + maven-dependency-plugin + 3.1.2 + + + org.apache.maven.plugins + maven-shade-plugin + 3.1.0 + + + package + + shade + + + + + Main + + + false + true + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 8 + 8 + + + + + + src/main/resources + true + + diff --git a/src/main/java/Main.java b/src/main/java/Main.java new file mode 100644 index 0000000..a1fc151 --- /dev/null +++ b/src/main/java/Main.java @@ -0,0 +1,303 @@ +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.*; +import java.net.URL; +import java.util.ArrayList; +import java.util.regex.Matcher; +import org.jaudiotagger.audio.AudioFile; +import org.jaudiotagger.audio.AudioFileIO; +import org.jaudiotagger.tag.FieldKey; +import org.jaudiotagger.tag.Tag; +import org.jaudiotagger.tag.datatype.Artwork; + +import javax.swing.*; +import javax.swing.filechooser.FileNameExtensionFilter; +import javax.swing.text.DefaultCaret; +import java.util.regex.Pattern; + +public class Main extends JFrame { + String textPath = ""; + JPanel panel = new JPanel(); + Boolean readyState = false; + JScrollPane scrollPane; + JButton editButton = new JButton("Edit Tags"); + int progress = 0; + JProgressBar progressBar = new JProgressBar(); + JLabel title = new JLabel("SUPER JUICER DOWNLOAD MUSIC COVERS AND TAG NOW 100% SAFE"); + JButton startButton = new JButton("Set .txt File"); + static JTextArea outputArea = new JTextArea("this is bery bery bery safe no worries no virus malwar ur monies back granteed"); + public Main(){ + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + this.setLocationRelativeTo(null); + this.add(panel); + panel.setLayout(new BoxLayout(panel,BoxLayout.PAGE_AXIS)); + scrollPane = new JScrollPane(outputArea); + scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + outputArea.setEditable(false); + outputArea.setLineWrap(true); + DefaultCaret caret = (DefaultCaret)outputArea.getCaret(); + caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE); + panel.add(Box.createRigidArea(new Dimension(0,5))); + panel.setBorder(BorderFactory.createEmptyBorder(25,10,20,10)); + startButton.setAlignmentX(CENTER_ALIGNMENT); + title.setAlignmentX(Component.CENTER_ALIGNMENT); + editButton.setAlignmentX(Component.CENTER_ALIGNMENT); + progressBar.setStringPainted(true); + title.setFont(new Font("Verdana", Font.PLAIN, 14)); + panel.add(title); + panel.add(Box.createVerticalStrut(10)); + panel.add(progressBar); + panel.add(Box.createVerticalStrut(10)); + panel.add(startButton); + panel.add(Box.createVerticalStrut(8)); + panel.add(scrollPane); + panel.add(Box.createVerticalStrut(5)); + panel.add(editButton); + startButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if(textPath.equals("")||readyState==false){ + outputArea.setText(outputArea.getText()+"\n"+"txt path has not been set. Launching chooserPane"); + System.out.println(".txt path has not been set. Launching chooserPane"); + textPath = showFileChooser(); + if(!textPath.equals("")){ + showWarning("File has been set.\nMake sure you add a new line for each URL.\nOr else say bye bye to your system32"); + readyState = true; + startButton.setText("Start Download"); + outputArea.setText(outputArea.getText()+"\n"+"Ready to begin downloading. Press the button"); + System.out.println("Ready to begin downloading. Press the button"); + } + } + else{ + Runnable runnable = () -> { + outputArea.setText(""); + startButton.setEnabled(false); + downloadLoop(); + startButton.setEnabled(true); + + }; + Thread thread = new Thread(runnable); + thread.start(); + } + } + }); + editButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e){ + + } + }); + this.setSize(550,300); + + } + public static void main(String[] args) { + new Main().setVisible(true); + } + private void downloadLoop(){ + ArrayList songs = readFile(textPath); + progress = 0; + for(int i = 0;i readFile(String fileName) { + ArrayList lines = new ArrayList(); + try { + FileReader fr = new FileReader(fileName); + BufferedReader br = new BufferedReader(fr); + String line; + while ((line = br.readLine()) != null) { + lines.add(line); + } + br.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return lines; + } + + + +} diff --git a/src/main/java/TagEditor.java b/src/main/java/TagEditor.java new file mode 100644 index 0000000..b2095e5 --- /dev/null +++ b/src/main/java/TagEditor.java @@ -0,0 +1,11 @@ +import javax.swing.*; +import java.awt.*; + +public class TagEditor extends JFrame { + JPanel mainPanel = new JPanel(); + GridBagConstraints constraints = new GridBagConstraints(); + public TagEditor(){ + mainPanel.setLayout(new GridBagLayout()); + this.setDefaultCloseOperation(EXIT_ON_CLOSE); + } +} diff --git a/youtube-dl.exe b/youtube-dl.exe new file mode 100644 index 0000000..730b7f5 Binary files /dev/null and b/youtube-dl.exe differ -- cgit v1.2.3