Added an option to use short names for 8muses

This commit is contained in:
cyian-1756 2018-03-12 15:02:34 -04:00
parent c9c8542945
commit d4c3d6a025

View File

@ -11,6 +11,7 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.rarchives.ripme.utils.Utils;
import org.jsoup.Connection.Response; import org.jsoup.Connection.Response;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
@ -125,7 +126,11 @@ public class EightmusesRipper extends AbstractHTMLRipper {
logger.info("Retrieving full-size image location from " + imageHref); logger.info("Retrieving full-size image location from " + imageHref);
image = getFullSizeImage(imageHref); image = getFullSizeImage(imageHref);
URL imageUrl = new URL(image); URL imageUrl = new URL(image);
addURLToDownload(imageUrl, getPrefix(x), getSubdir(page.select("title").text()), this.url.toExternalForm(), cookies, ""); if (Utils.getConfigBoolean("8muses.use_short_names", false)) {
addURLToDownload(imageUrl, getPrefixShort(x), getSubdir(page.select("title").text()), this.url.toExternalForm(), cookies, "");
} else {
addURLToDownload(imageUrl, getPrefixLong(x), getSubdir(page.select("title").text()), this.url.toExternalForm(), cookies);
}
// X is our page index // X is our page index
x++; x++;
@ -178,8 +183,11 @@ public class EightmusesRipper extends AbstractHTMLRipper {
addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies); addURLToDownload(url, getPrefix(index), "", this.url.toExternalForm(), cookies);
} }
@Override public String getPrefixLong(int index) {
public String getPrefix(int index) { return String.format("%03d_", index);
}
public String getPrefixShort(int index) {
return String.format("%03d", index); return String.format("%03d", index);
} }
} }