From e4c2b2e3fb99049cdc2b9a632cc2f4f7109519df Mon Sep 17 00:00:00 2001 From: 4pr0n Date: Tue, 10 Jun 2014 20:22:28 -0700 Subject: [PATCH] 1.0.60 - Fixing crazy directory creation bug #67 --- pom.xml | 2 +- src/main/java/com/rarchives/ripme/App.java | 1 + .../java/com/rarchives/ripme/ripper/AbstractRipper.java | 5 ++++- src/main/java/com/rarchives/ripme/ui/MainWindow.java | 8 ++------ src/main/java/com/rarchives/ripme/ui/UpdateUtils.java | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 5cfc17b3..58816614 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.rarchives.ripme ripme jar - 1.0.59 + 1.0.60 ripme http://rip.rarchives.com diff --git a/src/main/java/com/rarchives/ripme/App.java b/src/main/java/com/rarchives/ripme/App.java index e36bdaab..00a56644 100644 --- a/src/main/java/com/rarchives/ripme/App.java +++ b/src/main/java/com/rarchives/ripme/App.java @@ -41,6 +41,7 @@ public class App { public static void rip(URL url) throws Exception { AbstractRipper ripper = AbstractRipper.getRipper(url); + ripper.setup(); ripper.rip(); } diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java index dc7080d2..23cd368d 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java @@ -68,7 +68,10 @@ public abstract class AbstractRipper throw new MalformedURLException("Unable to rip url: " + url); } this.url = sanitizeURL(url); - setWorkingDir(url); + } + + public void setup() throws IOException { + setWorkingDir(this.url); Logger rootLogger = Logger.getRootLogger(); FileAppender fa = (FileAppender) rootLogger.getAppender("FILE"); fa.setFile(this.workingDir + File.separator + "log.txt"); diff --git a/src/main/java/com/rarchives/ripme/ui/MainWindow.java b/src/main/java/com/rarchives/ripme/ui/MainWindow.java index 1f51f1ac..0282cff4 100644 --- a/src/main/java/com/rarchives/ripme/ui/MainWindow.java +++ b/src/main/java/com/rarchives/ripme/ui/MainWindow.java @@ -377,18 +377,13 @@ public class MainWindow implements Runnable, RipStatusHandler { return; } try { - String urlText = ripTextfield.getText(); + String urlText = ripTextfield.getText().trim(); if (!urlText.startsWith("http:")) { urlText = "http://" + urlText; } URL url = new URL(urlText); AbstractRipper ripper = AbstractRipper.getRipper(url); statusWithColor(ripper.getHost() + " album detected", Color.GREEN); - File dir = ripper.getWorkingDir(); - if (dir.list().length == 1) { - new File(dir.getAbsolutePath() + File.separator + "log.txt").delete(); - } - ripper.cleanup(); } catch (Exception e) { statusWithColor("Can't rip this URL", Color.RED); } @@ -730,6 +725,7 @@ public class MainWindow implements Runnable, RipStatusHandler { boolean failed = false; try { ripper = AbstractRipper.getRipper(url); + ripper.setup(); } catch (Exception e) { failed = true; logger.error("Could not find ripper for URL " + url); diff --git a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java index 1b402d84..28ab54e1 100644 --- a/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java +++ b/src/main/java/com/rarchives/ripme/ui/UpdateUtils.java @@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils; public class UpdateUtils { private static final Logger logger = Logger.getLogger(UpdateUtils.class); - private static final String DEFAULT_VERSION = "1.0.59"; + private static final String DEFAULT_VERSION = "1.0.60"; private static final String updateJsonURL = "http://rarchives.com/ripme.json"; private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String mainFileName = "ripme.jar";