Merge pull request #739 from cyian-1756/appendFlag

Added flag for appending a string to folder name
This commit is contained in:
cyian-1756 2018-08-27 15:16:43 -04:00 committed by GitHub
commit 746c21c29a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 static final Logger logger = Logger.getLogger(App.class);
public static String stringToAppendToFoldername = null;
private static final History HISTORY = new History();
/**
@ -63,6 +64,12 @@ public class App {
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) {
handleArguments(args);
} else {
@ -295,6 +302,7 @@ public class App {
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("j", "update", false, "Update ripme");
opts.addOption("a","append-to-folder", true, "Append a string to the output folder name");
return opts;
}

View File

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