Various style cleanup.

This commit is contained in:
MetaPrime 2017-05-09 15:03:12 -07:00
parent 9410ea806c
commit d8d7b5096a
5 changed files with 40 additions and 55 deletions

View File

@ -98,7 +98,6 @@ public class App {
} }
if (cl.hasOption('R')) { if (cl.hasOption('R')) {
loadHistory(); loadHistory();
if (HISTORY.toList().size() == 0) { if (HISTORY.toList().size() == 0) {
System.err.println("There are no history entries to re-rip. Rip some albums first"); System.err.println("There are no history entries to re-rip. Rip some albums first");
System.exit(-1); System.exit(-1);
@ -124,7 +123,7 @@ public class App {
} }
if (added == 0) { if (added == 0) {
System.err.println("No history entries have been 'Checked'\n" + System.err.println("No history entries have been 'Checked'\n" +
"Check an entry by clicking the checkbox to the right of the URL or Right-click a URL to check/uncheck all items"); "Check an entry by clicking the checkbox to the right of the URL or Right-click a URL to check/uncheck all items");
System.exit(-1); System.exit(-1);
} }
} }
@ -138,33 +137,25 @@ 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')) { if (cl.hasOption('l')) {
// change the default rips directory // change the default rips directory
Utils.setConfigString("rips.directory", cl.getOptionValue('l')); Utils.setConfigString("rips.directory", cl.getOptionValue('l'));
} }
if (cl.hasOption('f')) { if (cl.hasOption('f')) {
String filename = cl.getOptionValue('f');
String filename = cl.getOptionValue('f');
try { try {
String url; String url;
BufferedReader br = new BufferedReader(new FileReader(filename));
BufferedReader br = new BufferedReader(new FileReader(filename));
while((url = br.readLine()) != null) { while((url = br.readLine()) != null) {
// loop through each url in the file and proces each url individually. // loop through each url in the file and proces each url individually.
ripURL(url.trim(), cl.hasOption("n")); ripURL(url.trim(), cl.hasOption("n"));
} }
} catch (FileNotFoundException fne) { } catch (FileNotFoundException fne) {
logger.error("[!] File containing list of URLs not found. Cannot continue."); logger.error("[!] File containing list of URLs not found. Cannot continue.");
} catch (IOException ioe) { } catch (IOException ioe) {
logger.error("[!] Failed reading file containing list of URLs. Cannot continue."); logger.error("[!] Failed reading file containing list of URLs. Cannot continue.");
} }
} }
if (cl.hasOption('u')) { if (cl.hasOption('u')) {
String url = cl.getOptionValue('u').trim(); String url = cl.getOptionValue('u').trim();
ripURL(url, cl.hasOption("n")); ripURL(url, cl.hasOption("n"));
@ -195,15 +186,15 @@ public class App {
public static Options getOptions() { public static Options getOptions() {
Options opts = new Options(); Options opts = new Options();
opts.addOption("h", "help", false, "Print the help"); opts.addOption("h", "help", false, "Print the help");
opts.addOption("u", "url", true, "URL of album to rip"); opts.addOption("u", "url", true, "URL of album to rip");
opts.addOption("t", "threads", true, "Number of download threads per rip"); opts.addOption("t", "threads", true, "Number of download threads per rip");
opts.addOption("w", "overwrite", false, "Overwrite existing files"); opts.addOption("w", "overwrite", false, "Overwrite existing files");
opts.addOption("r", "rerip", false, "Re-rip all ripped albums"); opts.addOption("r", "rerip", false, "Re-rip all ripped albums");
opts.addOption("R", "rerip-selected", false, "Re-rip all selected albums"); opts.addOption("R", "rerip-selected", false, "Re-rip all selected albums");
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)"); opts.addOption("l", "ripsdirectory", true, "Rips Directory (Default: ./rips)");
opts.addOption("n", "no-prop-file", false, "Do not create properties file."); opts.addOption("n", "no-prop-file", false, "Do not create properties file.");
opts.addOption("f", "urls-file", true, "Rip URLs from a file."); opts.addOption("f", "urls-file", true, "Rip URLs from a file.");

View File

@ -150,7 +150,6 @@ public abstract class AbstractRipper
return addURLToDownload(url, saveFileAs, referrer, cookies); return addURLToDownload(url, saveFileAs, referrer, cookies);
} }
/** /**
* Queues file to be downloaded and saved. With options. * Queues file to be downloaded and saved. With options.
* @param url * @param url

View File

@ -17,7 +17,6 @@ import com.rarchives.ripme.ripper.rippers.ripperhelpers.ChanSite;
import com.rarchives.ripme.utils.Http; import com.rarchives.ripme.utils.Http;
import com.rarchives.ripme.utils.RipUtils; import com.rarchives.ripme.utils.RipUtils;
public class ChanRipper extends AbstractHTMLRipper { public class ChanRipper extends AbstractHTMLRipper {
public static List<ChanSite> explicit_domains = Arrays.asList( public static List<ChanSite> explicit_domains = Arrays.asList(
new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org")), new ChanSite(Arrays.asList("boards.4chan.org"), Arrays.asList("4cdn.org", "is.4chan.org", "is2.4chan.org")),
@ -195,7 +194,6 @@ public class ChanRipper extends AbstractHTMLRipper {
} }
List<URL> urls = RipUtils.getFilesFromURL(originalURL); List<URL> urls = RipUtils.getFilesFromURL(originalURL);
//for (int i = 0; i < urls.size(); i++) {
for(URL imageurl : urls){ for(URL imageurl : urls){
imageURLs.add(imageurl.toString()); imageURLs.add(imageurl.toString());
} }

View File

@ -16,7 +16,6 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
public class History { public class History {
private final List<HistoryEntry> list; private final List<HistoryEntry> list;
private static final String[] COLUMNS = new String[] { private static final String[] COLUMNS = new String[] {
"URL", "URL",
@ -132,7 +131,7 @@ public class History {
return list; return list;
} }
public boolean isEmpty(){ public boolean isEmpty() {
return list.isEmpty(); return list.isEmpty();
} }
@ -144,5 +143,4 @@ public class History {
os.close(); os.close();
} }
} }
} }

View File

@ -17,7 +17,6 @@ import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import com.rarchives.ripme.utils.Utils; import com.rarchives.ripme.utils.Utils;
import java.util.Arrays;
public class UpdateUtils { public class UpdateUtils {