Logging fixes (#189)

This commit is contained in:
cyian-1756 2017-11-17 05:35:37 -05:00 committed by metaprime
parent 2efcc0af1f
commit a2fc44aced
4 changed files with 8 additions and 8 deletions

View File

@ -40,7 +40,7 @@ public class App {
public static void main(String[] args) throws MalformedURLException { public static void main(String[] args) throws MalformedURLException {
CommandLine cl = getArgs(args); CommandLine cl = getArgs(args);
if (args.length > 0 && cl.hasOption('v')){ if (args.length > 0 && cl.hasOption('v')){
System.out.println(UpdateUtils.getThisJarVersion()); logger.error(UpdateUtils.getThisJarVersion());
System.exit(0); System.exit(0);
} }
@ -107,7 +107,7 @@ 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"); logger.error("There are no history entries to re-rip. Rip some albums first");
System.exit(-1); System.exit(-1);
} }
int added = 0; int added = 0;
@ -130,7 +130,7 @@ public class App {
} }
} }
if (added == 0) { if (added == 0) {
System.err.println("No history entries have been 'Checked'\n" + logger.error("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);
} }
@ -142,7 +142,7 @@ public class App {
Utils.setConfigBoolean("download.save_order", false); Utils.setConfigBoolean("download.save_order", false);
} }
if ((cl.hasOption('d'))&&(cl.hasOption('D'))) { if ((cl.hasOption('d'))&&(cl.hasOption('D'))) {
System.err.println("\nCannot specify '-d' and '-D' simultaneously"); logger.error("\nCannot specify '-d' and '-D' simultaneously");
System.exit(-1); System.exit(-1);
} }
if (cl.hasOption('l')) { if (cl.hasOption('l')) {
@ -230,7 +230,7 @@ public class App {
HISTORY.fromFile(historyFile.getCanonicalPath()); HISTORY.fromFile(historyFile.getCanonicalPath());
} catch (IOException e) { } catch (IOException e) {
logger.error("Failed to load history from file " + historyFile, e); logger.error("Failed to load history from file " + historyFile, e);
System.out.println( logger.warn(
"RipMe failed to load the history file at " + historyFile.getAbsolutePath() + "\n\n" + "RipMe failed to load the history file at " + historyFile.getAbsolutePath() + "\n\n" +
"Error: " + e.getMessage() + "\n\n" + "Error: " + e.getMessage() + "\n\n" +
"Closing RipMe will automatically overwrite the contents of this file,\n" + "Closing RipMe will automatically overwrite the contents of this file,\n" +

View File

@ -55,7 +55,7 @@ public class MotherlessVideoRipper extends VideoRipper {
logger.info(" Retrieving " + this.url); logger.info(" Retrieving " + this.url);
String html = Http.url(this.url).get().toString(); String html = Http.url(this.url).get().toString();
if (html.contains("__fileurl = '")) { if (html.contains("__fileurl = '")) {
System.err.println("WTF"); logger.error("WTF");
} }
List<String> vidUrls = Utils.between(html, "__fileurl = '", "';"); List<String> vidUrls = Utils.between(html, "__fileurl = '", "';");
if (vidUrls.size() == 0) { if (vidUrls.size() == 0) {

View File

@ -111,7 +111,7 @@ public class UpdateUtils {
int[] oldVersions = versionStringToInt(getThisJarVersion()); int[] oldVersions = versionStringToInt(getThisJarVersion());
int[] newVersions = versionStringToInt(latestVersion); int[] newVersions = versionStringToInt(latestVersion);
if (oldVersions.length < newVersions.length) { if (oldVersions.length < newVersions.length) {
System.err.println("Calculated: " + getThisJarVersion() + " < " + latestVersion); logger.error("Calculated: " + getThisJarVersion() + " < " + latestVersion);
return true; return true;
} }

View File

@ -94,7 +94,7 @@ public class RipUtils {
Pattern p = Pattern.compile("https?://i.reddituploads.com/([a-zA-Z0-9]+)\\?.*"); Pattern p = Pattern.compile("https?://i.reddituploads.com/([a-zA-Z0-9]+)\\?.*");
Matcher m = p.matcher(url.toExternalForm()); Matcher m = p.matcher(url.toExternalForm());
if (m.matches()) { if (m.matches()) {
System.out.println("URL: " + url.toExternalForm()); logger.info("URL: " + url.toExternalForm());
String u = url.toExternalForm().replaceAll("&amp;", "&"); String u = url.toExternalForm().replaceAll("&amp;", "&");
try { try {
result.add(new URL(u)); result.add(new URL(u));