Added the -l flag which allows the rip directory to be selected via the command line
This commit is contained in:
parent
1255a76bf3
commit
fe39ed8ed7
@ -94,6 +94,10 @@ public class App {
|
|||||||
System.err.println("\nCannot specify '-d' and '-D' simultaneously");
|
System.err.println("\nCannot specify '-d' and '-D' simultaneously");
|
||||||
System.exit(-1);
|
System.exit(-1);
|
||||||
}
|
}
|
||||||
|
if(cl.hasOption('l')) {
|
||||||
|
// change the default rips directory
|
||||||
|
Utils.setConfigString("rips.directory", cl.getOptionValue('l'));
|
||||||
|
}
|
||||||
if (cl.hasOption('u')) {
|
if (cl.hasOption('u')) {
|
||||||
// User provided URL, rip it.
|
// User provided URL, rip it.
|
||||||
try {
|
try {
|
||||||
@ -130,6 +134,7 @@ public class App {
|
|||||||
opts.addOption("d", "saveorder", false, "Save the order of images in album");
|
opts.addOption("d", "saveorder", false, "Save the order of images in album");
|
||||||
opts.addOption("D", "nosaveorder", false, "Don't save order of images");
|
opts.addOption("D", "nosaveorder", false, "Don't save order of images");
|
||||||
opts.addOption("4", "skip404", false, "Don't retry after a 404 (not found) error");
|
opts.addOption("4", "skip404", false, "Don't retry after a 404 (not found) error");
|
||||||
|
opts.addOption("l", "ripsdirectory", true, "Rips Directory (Default: ./rips)");
|
||||||
return opts;
|
return opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ public class Utils {
|
|||||||
* saveAs in relation to the CWD
|
* saveAs in relation to the CWD
|
||||||
*/
|
*/
|
||||||
public static String removeCWD(File saveAs) {
|
public static String removeCWD(File saveAs) {
|
||||||
String prettySaveAs = saveAs.toString();
|
String prettySaveAs = saveAs.toString();
|
||||||
try {
|
try {
|
||||||
prettySaveAs = saveAs.getCanonicalPath();
|
prettySaveAs = saveAs.getCanonicalPath();
|
||||||
String cwd = new File(".").getCanonicalPath() + File.separator;
|
String cwd = new File(".").getCanonicalPath() + File.separator;
|
||||||
@ -164,7 +164,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return prettySaveAs;
|
return prettySaveAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String stripURLParameter(String url, String parameter) {
|
public static String stripURLParameter(String url, String parameter) {
|
||||||
int paramIndex = url.indexOf("?" + parameter);
|
int paramIndex = url.indexOf("?" + parameter);
|
||||||
boolean wasFirstParam = true;
|
boolean wasFirstParam = true;
|
||||||
@ -172,7 +172,7 @@ public class Utils {
|
|||||||
wasFirstParam = false;
|
wasFirstParam = false;
|
||||||
paramIndex = url.indexOf("&" + parameter);
|
paramIndex = url.indexOf("&" + parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(paramIndex > 0) {
|
if(paramIndex > 0) {
|
||||||
int nextParam = url.indexOf("&", paramIndex+1);
|
int nextParam = url.indexOf("&", paramIndex+1);
|
||||||
if(nextParam != -1) {
|
if(nextParam != -1) {
|
||||||
@ -183,7 +183,7 @@ public class Utils {
|
|||||||
url = url.substring(0, paramIndex);
|
url = url.substring(0, paramIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,7 +271,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final int SHORTENED_PATH_LENGTH = 12;
|
public static final int SHORTENED_PATH_LENGTH = 12;
|
||||||
public static String shortenPath(String path) {
|
public static String shortenPath(String path) {
|
||||||
return shortenPath(new File(path));
|
return shortenPath(new File(path));
|
||||||
@ -285,7 +285,7 @@ public class Utils {
|
|||||||
+ "..."
|
+ "..."
|
||||||
+ path.substring(path.length() - SHORTENED_PATH_LENGTH);
|
+ path.substring(path.length() - SHORTENED_PATH_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String filesystemSafe(String text) {
|
public static String filesystemSafe(String text) {
|
||||||
text = text.replaceAll("[^a-zA-Z0-9.-]", "_")
|
text = text.replaceAll("[^a-zA-Z0-9.-]", "_")
|
||||||
.replaceAll("__", "_")
|
.replaceAll("__", "_")
|
||||||
@ -295,7 +295,7 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String bytesToHumanReadable(int bytes) {
|
public static String bytesToHumanReadable(int bytes) {
|
||||||
float fbytes = (float) bytes;
|
float fbytes = (float) bytes;
|
||||||
String[] mags = new String[] {"", "k", "m", "g", "t"};
|
String[] mags = new String[] {"", "k", "m", "g", "t"};
|
||||||
@ -387,4 +387,4 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user