diff --git a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java index fe8074fb..6c79c63f 100644 --- a/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java +++ b/src/main/java/com/rarchives/ripme/ripper/AbstractRipper.java @@ -218,6 +218,44 @@ public abstract class AbstractRipper protected abstract boolean addURLToDownload(URL url, File saveAs, String referrer, Map cookies, Boolean getFileExtFromMIME); + /** + * Queues image to be downloaded and saved. + * @param url + * URL of the file + * @param options + * A map containing any changes to the default options. + * Options are getFileExtFromMIME, prefix, subdirectory, referrer, fileName, extension, getFileExtFromMIME. + * getFileExtFromMIME should be "true" or "false" + * @param cookies + * The cookies to send to the server while downloading this file. + * @return + * True if downloaded successfully + * False if failed to download + */ + protected boolean addURLToDownload(URL url, Map options, Map cookies) { + // Bit of a hack but this lets us pass a bool using a map + boolean useMIME = options.getOrDefault("getFileExtFromMIME", "false").toLowerCase().equals("true"); + return addURLToDownload(url, options.getOrDefault("prefix", ""), options.getOrDefault("subdirectory", ""), options.getOrDefault("referrer", null), + cookies, options.getOrDefault("fileName", ""), options.getOrDefault("extension", null), useMIME); + } + + + /** + * Queues image to be downloaded and saved. + * @param url + * URL of the file + * @param options + * A map containing any changes to the default options. + * Options are getFileExtFromMIME, prefix, subdirectory, referrer, fileName, extension, getFileExtFromMIME. + * getFileExtFromMIME should be "true" or "false" + * @return + * True if downloaded successfully + * False if failed to download + */ + protected boolean addURLToDownload(URL url, Map options) { + return addURLToDownload(url, options, null); + } + /** * Queues image to be downloaded and saved. * @param url