Added flag for appending a string to folder name

This commit is contained in:
cyian-1756 2018-06-24 03:05:22 -04:00
parent a855957ab1
commit bbef5ed76e
2 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import com.rarchives.ripme.utils.Utils;
public class App { public class App {
public static final Logger logger = Logger.getLogger(App.class); public static final Logger logger = Logger.getLogger(App.class);
public static String stringToAppendToFoldername = null;
private static final History HISTORY = new History(); private static final History HISTORY = new History();
/** /**
@ -63,6 +64,12 @@ public class App {
Proxy.setSocks(Utils.getConfigString("proxy.socks", null)); Proxy.setSocks(Utils.getConfigString("proxy.socks", null));
} }
// This has to be here instead of handleArgs because handleArgs isn't parsed until after a item is ripper
if (cl.hasOption("a")) {
logger.info(cl.getOptionValue("a"));
stringToAppendToFoldername = cl.getOptionValue("a");
}
if (GraphicsEnvironment.isHeadless() || args.length > 0) { if (GraphicsEnvironment.isHeadless() || args.length > 0) {
handleArguments(args); handleArguments(args);
} else { } else {
@ -295,6 +302,7 @@ public class App {
opts.addOption("s", "socks-server", true, "Use socks server ([user:password]@host[:port])"); opts.addOption("s", "socks-server", true, "Use socks server ([user:password]@host[:port])");
opts.addOption("p", "proxy-server", true, "Use HTTP Proxy server ([user:password]@host[:port])"); opts.addOption("p", "proxy-server", true, "Use HTTP Proxy server ([user:password]@host[:port])");
opts.addOption("j", "update", false, "Update ripme"); opts.addOption("j", "update", false, "Update ripme");
opts.addOption("a","append-to-folder", true, "Append a string to the output folder name");
return opts; return opts;
} }

View File

@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Observable; import java.util.Observable;
import com.rarchives.ripme.App;
import org.apache.log4j.FileAppender; import org.apache.log4j.FileAppender;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jsoup.HttpStatusException; import org.jsoup.HttpStatusException;
@ -258,8 +259,12 @@ public abstract class AbstractRipper
subdirectory = File.separator + subdirectory; subdirectory = File.separator + subdirectory;
} }
prefix = Utils.filesystemSanitized(prefix); prefix = Utils.filesystemSanitized(prefix);
String topFolderName = workingDir.getCanonicalPath();
if (App.stringToAppendToFoldername != null) {
topFolderName = topFolderName + App.stringToAppendToFoldername;
}
saveFileAs = new File( saveFileAs = new File(
workingDir.getCanonicalPath() topFolderName
+ subdirectory + subdirectory
+ File.separator + File.separator
+ prefix + prefix