1.0.60 - Fixing crazy directory creation bug #67

This commit is contained in:
4pr0n 2014-06-10 20:22:28 -07:00
parent ad984930ab
commit e4c2b2e3fb
5 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.rarchives.ripme</groupId> <groupId>com.rarchives.ripme</groupId>
<artifactId>ripme</artifactId> <artifactId>ripme</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.59</version> <version>1.0.60</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -41,6 +41,7 @@ public class App {
public static void rip(URL url) throws Exception { public static void rip(URL url) throws Exception {
AbstractRipper ripper = AbstractRipper.getRipper(url); AbstractRipper ripper = AbstractRipper.getRipper(url);
ripper.setup();
ripper.rip(); ripper.rip();
} }

View File

@ -68,7 +68,10 @@ public abstract class AbstractRipper
throw new MalformedURLException("Unable to rip url: " + url); throw new MalformedURLException("Unable to rip url: " + url);
} }
this.url = sanitizeURL(url); this.url = sanitizeURL(url);
setWorkingDir(url); }
public void setup() throws IOException {
setWorkingDir(this.url);
Logger rootLogger = Logger.getRootLogger(); Logger rootLogger = Logger.getRootLogger();
FileAppender fa = (FileAppender) rootLogger.getAppender("FILE"); FileAppender fa = (FileAppender) rootLogger.getAppender("FILE");
fa.setFile(this.workingDir + File.separator + "log.txt"); fa.setFile(this.workingDir + File.separator + "log.txt");

View File

@ -377,18 +377,13 @@ public class MainWindow implements Runnable, RipStatusHandler {
return; return;
} }
try { try {
String urlText = ripTextfield.getText(); String urlText = ripTextfield.getText().trim();
if (!urlText.startsWith("http:")) { if (!urlText.startsWith("http:")) {
urlText = "http://" + urlText; urlText = "http://" + urlText;
} }
URL url = new URL(urlText); URL url = new URL(urlText);
AbstractRipper ripper = AbstractRipper.getRipper(url); AbstractRipper ripper = AbstractRipper.getRipper(url);
statusWithColor(ripper.getHost() + " album detected", Color.GREEN); 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) { } catch (Exception e) {
statusWithColor("Can't rip this URL", Color.RED); statusWithColor("Can't rip this URL", Color.RED);
} }
@ -730,6 +725,7 @@ public class MainWindow implements Runnable, RipStatusHandler {
boolean failed = false; boolean failed = false;
try { try {
ripper = AbstractRipper.getRipper(url); ripper = AbstractRipper.getRipper(url);
ripper.setup();
} catch (Exception e) { } catch (Exception e) {
failed = true; failed = true;
logger.error("Could not find ripper for URL " + url); logger.error("Could not find ripper for URL " + url);

View File

@ -21,7 +21,7 @@ import com.rarchives.ripme.utils.Utils;
public class UpdateUtils { public class UpdateUtils {
private static final Logger logger = Logger.getLogger(UpdateUtils.class); 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 updateJsonURL = "http://rarchives.com/ripme.json";
private static final String updateJarURL = "http://rarchives.com/ripme.jar"; private static final String updateJarURL = "http://rarchives.com/ripme.jar";
private static final String mainFileName = "ripme.jar"; private static final String mainFileName = "ripme.jar";