1.0.35 - Fixing i.rarchives ripper (closes #34)

Also fixed empty directory delete (waits for threads to finish first)
This commit is contained in:
4pr0n 2014-05-04 22:49:32 -07:00
parent ab018abf03
commit 28b45e34ed
4 changed files with 18 additions and 3 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.34</version> <version>1.0.35</version>
<name>ripme</name> <name>ripme</name>
<url>http://rip.rarchives.com</url> <url>http://rip.rarchives.com</url>
<properties> <properties>

View File

@ -290,9 +290,11 @@ public abstract class AbstractRipper
rip(); rip();
} catch (HttpStatusException e) { } catch (HttpStatusException e) {
logger.error("Got exception while running ripper:", e); logger.error("Got exception while running ripper:", e);
waitForThreads();
sendUpdate(STATUS.RIP_ERRORED, "Status=" + e.getStatusCode() + ", URL=" + e.getUrl()); sendUpdate(STATUS.RIP_ERRORED, "Status=" + e.getStatusCode() + ", URL=" + e.getUrl());
} catch (IOException e) { } catch (IOException e) {
logger.error("Got exception while running ripper:", e); logger.error("Got exception while running ripper:", e);
waitForThreads();
sendUpdate(STATUS.RIP_ERRORED, e.getMessage()); sendUpdate(STATUS.RIP_ERRORED, e.getMessage());
} finally { } finally {
if (this.workingDir.list().length == 0) { if (this.workingDir.list().length == 0) {

View File

@ -36,6 +36,12 @@ public class IrarchivesRipper extends AlbumRipper {
public URL sanitizeURL(URL url) throws MalformedURLException { public URL sanitizeURL(URL url) throws MalformedURLException {
String u = url.toExternalForm(); String u = url.toExternalForm();
String searchTerm = u.substring(u.indexOf("?") + 1); String searchTerm = u.substring(u.indexOf("?") + 1);
if (searchTerm.startsWith("url=")) {
if (!searchTerm.contains("http")
&& !searchTerm.contains(":")) {
searchTerm = searchTerm.replace("url=", "user=");
}
}
return new URL("http://i.rarchives.com/search.cgi?" + searchTerm); return new URL("http://i.rarchives.com/search.cgi?" + searchTerm);
} }
@ -58,7 +64,14 @@ public class IrarchivesRipper extends AlbumRipper {
JSONObject post = (JSONObject) posts.get(i); JSONObject post = (JSONObject) posts.get(i);
String theUrl = post.getString("url"); String theUrl = post.getString("url");
if (theUrl.contains("imgur.com/a/")) { if (theUrl.contains("imgur.com/a/")) {
ImgurAlbum album = ImgurRipper.getImgurAlbum(new URL(theUrl)); ImgurAlbum album = null;
try {
album = ImgurRipper.getImgurAlbum(new URL(theUrl));
} catch (IOException e) {
logger.error("Error loading imgur album " + theUrl, e);
sendUpdate(STATUS.DOWNLOAD_ERRORED, "Can't download " + theUrl + " : " + e.getMessage());
continue;
}
int albumIndex = 0; int albumIndex = 0;
for (ImgurImage image : album.images) { for (ImgurImage image : album.images) {
albumIndex++; albumIndex++;

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.34"; private static final String DEFAULT_VERSION = "1.0.35";
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";