Added a way for rippers to add urls to the download queue
This commit is contained in:
parent
c5a8f0cd08
commit
e33d24364e
@ -11,6 +11,7 @@ import org.jsoup.nodes.Document;
|
||||
|
||||
import com.rarchives.ripme.ui.RipStatusMessage.STATUS;
|
||||
import com.rarchives.ripme.utils.Utils;
|
||||
import com.rarchives.ripme.ui.MainWindow;
|
||||
|
||||
/**
|
||||
* Simplified ripper, designed for ripping from sites by parsing HTML.
|
||||
@ -53,12 +54,29 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
|
||||
protected boolean hasDescriptionSupport() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected String[] getDescription(String url, Document page) throws IOException {
|
||||
throw new IOException("getDescription not implemented"); // Do I do this or make an abstract function?
|
||||
}
|
||||
protected int descSleepTime() {
|
||||
return 100;
|
||||
}
|
||||
|
||||
protected List<String> getAlbumsToQueue(Document doc) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// If a page has Queue support than it has no images we want to download, just a list of urls we want to add to
|
||||
// the queue
|
||||
protected boolean hasQueueSupport() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Takes a url and checks if it is for a page of albums
|
||||
protected boolean pageContainsAlbums(URL url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rip() throws IOException {
|
||||
int index = 0;
|
||||
@ -67,6 +85,15 @@ public abstract class AbstractHTMLRipper extends AlbumRipper {
|
||||
sendUpdate(STATUS.LOADING_RESOURCE, this.url.toExternalForm());
|
||||
Document doc = getFirstPage();
|
||||
|
||||
if (hasQueueSupport() && pageContainsAlbums(this.url)) {
|
||||
List<String> urls = getAlbumsToQueue(doc);
|
||||
for (String url : urls) {
|
||||
MainWindow.addUrlToQueue(url);
|
||||
}
|
||||
|
||||
doc = null;
|
||||
}
|
||||
|
||||
while (doc != null) {
|
||||
if (alreadyDownloadedUrls >= Utils.getConfigInteger("history.end_rip_after_already_seen", 1000000000) && !isThisATest()) {
|
||||
sendUpdate(STATUS.DOWNLOAD_COMPLETE, "Already seen the last " + alreadyDownloadedUrls + " images ending rip");
|
||||
|
Loading…
Reference in New Issue
Block a user