From a5e0f456383f006bcbc984ca596572fc64dc1405 Mon Sep 17 00:00:00 2001 From: Jan-Pascal van Best Date: Fri, 23 Mar 2012 17:06:34 +0100 Subject: [PATCH] Added --license option (does not work yet) and GPL boilerplate on program start --- src/main/java/org/vanbest/xmltv/Main.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/vanbest/xmltv/Main.java b/src/main/java/org/vanbest/xmltv/Main.java index 49d9abf..d834329 100644 --- a/src/main/java/org/vanbest/xmltv/Main.java +++ b/src/main/java/org/vanbest/xmltv/Main.java @@ -57,7 +57,10 @@ public class Main { public void run() throws FactoryConfigurationError, Exception { if (!config.quiet) { - System.out.println("tv_grab_nl_java version "+config.project_version); + System.out.println("tv_grab_nl_java version "+config.project_version + ", Copyright (C) 2012 Jan-Pascal van Best "); + System.out.println("tv_grab_nl_java comes with ABSOLUTELY NO WARRANTY. It is free software, and you are welcome to redistribute it"); + System.out.println("under certain conditions; `tv_grab_nl_java --license' for details."); + System.out.println("Fetching programme data for days " + this.offset + "-" + (this.offset+this.days-1)); System.out.println("... from " + config.channels.size() + " channels"); System.out.println("... using cache file " + config.cacheFile.getCanonicalPath()); @@ -170,6 +173,15 @@ public class Main { e.printStackTrace(); } } + + public void showLicense() { + InputStream in = this.getClass().getResourceAsStream("/LICENSE"); + try { + configProp.load(in); + } catch (IOException e) { + e.printStackTrace(); + } + } public void processOptions(String[] args) throws FileNotFoundException { Options options = new Options(); @@ -184,6 +196,7 @@ public class Main { options.addOption("h", "cache", true, "Cache file location"); options.addOption("e", "help", false, "Show this help"); options.addOption("l", "log-level", true, "Set log level (0x0100=JSON)"); + options.addOption("i", "license", false, "Show license information"); //options.addOption("p", "preferredmethod", false, "Show preferred method"); CommandLine line = null; @@ -193,7 +206,11 @@ public class Main { // TODO Auto-generated catch block e.printStackTrace(); } - + + if(line.hasOption("i")) { + showLicense(); + System.exit(0); + } if(line.hasOption("f")) { configFile = new File(line.getOptionValue("f")); } -- 2.39.5