Merge pull request #727 from cyian-1756/redditHIstoryFix
Reddit history fix
This commit is contained in:
commit
90171bfbd9
@ -97,7 +97,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
|
|||||||
|
|
||||||
while (doc != null) {
|
while (doc != null) {
|
||||||
if (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest()) {
|
if (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest()) {
|
||||||
sendUpdate(STATUS.DOWNLOAD_COMPLETE, "Already seen the last " + alreadyDownloadedUrls + " images ending rip");
|
sendUpdate(STATUS.DOWNLOAD_COMPLETE_HISTORY, "Already seen the last " + alreadyDownloadedUrls + " images ending rip");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
List<String> imageURLs = getURLsFromPage(doc);
|
List<String> imageURLs = getURLsFromPage(doc);
|
||||||
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import com.rarchives.ripme.ui.RipStatusMessage;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.json.JSONTokener;
|
import org.json.JSONTokener;
|
||||||
@ -39,6 +40,10 @@ public class RedditRipper extends AlbumRipper {
|
|||||||
|
|
||||||
private long lastRequestTime = 0;
|
private long lastRequestTime = 0;
|
||||||
|
|
||||||
|
private Boolean shouldAddURL() {
|
||||||
|
return (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canRip(URL url) {
|
public boolean canRip(URL url) {
|
||||||
return url.getHost().endsWith(DOMAIN);
|
return url.getHost().endsWith(DOMAIN);
|
||||||
@ -65,6 +70,10 @@ public class RedditRipper extends AlbumRipper {
|
|||||||
public void rip() throws IOException {
|
public void rip() throws IOException {
|
||||||
URL jsonURL = getJsonURL(this.url);
|
URL jsonURL = getJsonURL(this.url);
|
||||||
while (true) {
|
while (true) {
|
||||||
|
if (shouldAddURL()) {
|
||||||
|
sendUpdate(RipStatusMessage.STATUS.DOWNLOAD_COMPLETE_HISTORY, "Already seen the last " + alreadyDownloadedUrls + " images ending rip");
|
||||||
|
break;
|
||||||
|
}
|
||||||
jsonURL = getAndParseAndReturnNext(jsonURL);
|
jsonURL = getAndParseAndReturnNext(jsonURL);
|
||||||
if (jsonURL == null || isThisATest() || isStopped()) {
|
if (jsonURL == null || isThisATest() || isStopped()) {
|
||||||
break;
|
break;
|
||||||
|
@ -1206,6 +1206,12 @@ public final class MainWindow implements Runnable, RipStatusHandler {
|
|||||||
appendLog("Downloaded " + msg.getObject(), Color.GREEN);
|
appendLog("Downloaded " + msg.getObject(), Color.GREEN);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case DOWNLOAD_COMPLETE_HISTORY:
|
||||||
|
if (LOGGER.isEnabledFor(Level.INFO)) {
|
||||||
|
appendLog("" + msg.getObject(), Color.GREEN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case DOWNLOAD_ERRORED:
|
case DOWNLOAD_ERRORED:
|
||||||
if (LOGGER.isEnabledFor(Level.ERROR)) {
|
if (LOGGER.isEnabledFor(Level.ERROR)) {
|
||||||
appendLog((String) msg.getObject(), Color.RED);
|
appendLog((String) msg.getObject(), Color.RED);
|
||||||
|
@ -10,6 +10,7 @@ public class RipStatusMessage {
|
|||||||
DOWNLOAD_STARTED("Download Started"),
|
DOWNLOAD_STARTED("Download Started"),
|
||||||
DOWNLOAD_COMPLETE("Download Complete"),
|
DOWNLOAD_COMPLETE("Download Complete"),
|
||||||
DOWNLOAD_ERRORED("Download Errored"),
|
DOWNLOAD_ERRORED("Download Errored"),
|
||||||
|
DOWNLOAD_COMPLETE_HISTORY("Download Complete History"),
|
||||||
RIP_COMPLETE("Rip Complete"),
|
RIP_COMPLETE("Rip Complete"),
|
||||||
DOWNLOAD_WARN("Download problem"),
|
DOWNLOAD_WARN("Download problem"),
|
||||||
TOTAL_BYTES("Total bytes"),
|
TOTAL_BYTES("Total bytes"),
|
||||||
|
Loading…
Reference in New Issue
Block a user