diff options
| author | Pinapelz <donaldshan1@outlook.com> | 2023-03-05 15:56:20 -0800 |
|---|---|---|
| committer | Pinapelz <donaldshan1@outlook.com> | 2023-03-05 15:56:20 -0800 |
| commit | 3d328f8ed2e839cac142abbe905eeac4471ec071 (patch) | |
| tree | 621ebd1ef64ff8ef4401172ec2ef3f500456fa7d | |
| parent | 34d5e8a827c24e249e889c7a6148e79f4a2f673d (diff) | |
Updated .gitinore and remove checkUpdate()
| -rw-r--r-- | .gitignore | 10 | ||||
| -rw-r--r-- | src/main/java/Main.java | 57 |
2 files changed, 10 insertions, 57 deletions
@@ -13,3 +13,13 @@ *.class *.json songs.txt +.idea/modules.xml +.idea/vcs.xml +.idea/libraries/Maven__org_jaudiotagger_2_0_3.xml +.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml +.idea/libraries/Maven__junit_junit_4_11.xml +.idea/libraries/Maven__commons_io_commons_io_2_8_0.xml +.idea/libraries/Maven__com_mpatric_mp3agic_0_9_1.xml +.idea/libraries/Maven__com_jgoodies_jgoodies_forms_1_8_0.xml +.idea/libraries/Maven__com_jgoodies_jgoodies_common_1_8_0.xml +.idea/ytmp3AutoTag.iml diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 9a971da..cf81d38 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -237,12 +237,8 @@ public class Main extends JFrame { panel.add(useBlacklistBox);
panel.add(Box.createVerticalStrut(8));
panel.add(version);
- //panel.add(Box.createVerticalStrut(5));
- //panel.add(songsGen);
-
this.setSize(550,450);
this.setTitle("YTMP3Tagger");
- checkUpdate();
}
@@ -328,59 +324,6 @@ public class Main extends JFrame { }
});
}
- private void checkUpdate(){ //Check website for any updates and if the versions do not match then download new upate
- try{
- URL url = new URL(versionURL);
- URLConnection con = url.openConnection();
- InputStream in = con.getInputStream();
- String encoding = con.getContentEncoding();
- encoding = encoding == null ? "UTF-8" : encoding;
- String body = IOUtils.toString(in, encoding);
- ArrayList<String> lines = new ArrayList<String>(Arrays.asList(body.split("\\r?\\n")));
- if(VERSION.equals(lines.get(0))){
- System.out.println("Program is up to date");
- }
- else{
- int dialogResult = JOptionPane.showConfirmDialog (null, "New Version Found!\nWould you like to download the new version?","New Version Found!",JOptionPane.YES_NO_OPTION);
- if(dialogResult==JOptionPane.YES_OPTION){
- lines.remove(0);
- for(int i =0;i<lines.size();i++) {
- if (lines.get(i).startsWith("add")) {
- lines.set(i, lines.get(i).replace("add", ""));
- String[] parts = lines.get(i).split("/");
- ProcessBuilder builder = new ProcessBuilder(
- "cmd.exe", "/c", "curl " + lines.get(i) + " -o " + parts[parts.length - 1]);
- builder.redirectErrorStream(true);
- Process p = builder.start();
- p.waitFor();
- }
- //delete old files
- else if (lines.get(i).startsWith("del")) {
- lines.set(i, lines.get(i).replace("del", ""));
- lines.set(i, lines.get(i).replaceAll("\\s+", ""));
- System.out.println(lines.get(i));
- File f = new File(lines.get(i));
- f.delete();
- }
- //when the new version update process calls for end the program will end and relaunch the new version
- else if (lines.get(i).equals("end")) {
- ProcessBuilder builder = new ProcessBuilder(
- "cmd.exe", "/c", "RUN_THIS_TO_START_PROGRAM.bat");
- Process p = builder.start();
- p.waitFor();
- System.exit(0);
- }
- }
- }
- else{
-
- }
- }
- }
- catch(Exception ex){
- ex.printStackTrace();
- }
- }
}
|
