public List<Channel> channels;
public Map<String, String> cattrans;
protected File cacheFile;
+ boolean quiet = false;
private Config() {
}
result.setChannels(channels);
result.cattrans = cattrans;
result.cacheFile = cacheFile;
- //System.out.println("CAche file: "+cacheFile.getPath());
} catch (IOException e) {
System.out.println("Cannot read configuration file, continuing with empty configuration");
return getDefaultConfig();
private PrintStream outputWriter;
private int days = 5;
private int offset = 0;
- private boolean quiet = false;
/**
* @param args
*/
}
public void run() throws FactoryConfigurationError, Exception {
- if (!quiet) {
+ if (!config.quiet) {
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());
TvGids gids = new TvGids(config);
for (int day=offset; day<offset+days; day++) {
- if (!quiet) System.out.print("Fetching information for day " + day);
+ if (!config.quiet) System.out.print("Fetching information for day " + day);
Set<Programme> programmes = new HashSet<Programme>();
for( Channel c: config.channels ) {
- if (!quiet) System.out.print(".");
+ if (!config.quiet) System.out.print(".");
ArrayList<Channel> cs = new ArrayList<Channel>(2);
cs.add(c);
Set<Programme> p = gids.getProgrammes(cs, day, true);
writer.writePrograms(p);
writer.flush();
}
- if (!quiet) System.out.println();
+ if (!config.quiet) System.out.println();
}
try {
}
writer.close();
- if (!quiet) {
+ if (!config.quiet) {
System.out.println("Number of programmes from cache: " + gids.cacheHits);
System.out.println("Number of programmes fetched: " + gids.cacheMisses);
System.out.println("Number of fetch errors: " + gids.fetchErrors);
formatter.printHelp( "tv_grab_nl_java", options );
System.exit(0);
}
- if (line.hasOption("q")) {
- this.quiet = true;
- }
if(line.hasOption("f")) {
configFile = new File(line.getOptionValue("f"));
}
config = Config.readConfig(configFile);
+ if (line.hasOption("q")) {
+ config.quiet = true;
+ }
if (line.hasOption("o")) {
this.outputWriter = new PrintStream( new FileOutputStream(line.getOptionValue("o")));
String regisseur;
String zender_id;
- public void fixup(Programme p) {
+ public void fixup(Programme p, boolean quiet) {
this.titel = org.apache.commons.lang.StringEscapeUtils.unescapeHtml(titel);
this.genre = org.apache.commons.lang.StringEscapeUtils.unescapeHtml(genre);
this.synop = org.apache.commons.lang.StringEscapeUtils.unescapeHtml(synop);
titel = parts[0].trim();
p.titel = titel;
synop = parts[1].trim();
- System.out.println("Splitting title to : \"" + p.titel + "\"; synop: \"" + synop + "\"");
+ if (!quiet) {
+ System.out.println("Splitting title to : \"" + p.titel + "\"; synop: \"" + synop + "\"");
+ }
}
}
this.presentatie = org.apache.commons.lang.StringEscapeUtils.unescapeHtml(presentatie);