Added hasASAPRipping(), which if returns true allows a ripper to not return anything from getURLsFromPage()

This commit is contained in:
cyian-1756 2017-12-02 04:49:53 -05:00
parent 5a21a820b3
commit e89b27dc14

View File

@ -53,6 +53,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
protected boolean hasDescriptionSupport() { protected boolean hasDescriptionSupport() {
return false; return false;
} }
public boolean hasASAPRipping() {return false;}
protected String[] getDescription(String url, Document page) throws IOException { protected String[] getDescription(String url, Document page) throws IOException {
throw new IOException("getDescription not implemented"); // Do I do this or make an abstract function? throw new IOException("getDescription not implemented"); // Do I do this or make an abstract function?
} }
@ -68,7 +69,9 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
Document doc = getFirstPage(); Document doc = getFirstPage();
while (doc != null) { while (doc != null) {
List<String> imageURLs = getURLsFromPage(doc); List<String> imageURLs;
if (!hasASAPRipping()) {
imageURLs = getURLsFromPage(doc);
// Remove all but 1 image // Remove all but 1 image
if (isThisATest()) { if (isThisATest()) {
while (imageURLs.size() > 1) { while (imageURLs.size() > 1) {
@ -88,6 +91,7 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
break; break;
} }
} }
}
if (hasDescriptionSupport() && Utils.getConfigBoolean("descriptions.save", false)) { if (hasDescriptionSupport() && Utils.getConfigBoolean("descriptions.save", false)) {
logger.debug("Fetching description(s) from " + doc.location()); logger.debug("Fetching description(s) from " + doc.location());
List<String> textURLs = getDescriptionsFromPage(doc); List<String> textURLs = getDescriptionsFromPage(doc);