From abcc2cf4f1d213887efe3438b09ad9da66f36586 Mon Sep 17 00:00:00 2001 From: Jan-Pascal van Best <janpascal@vanbest.org> Date: Tue, 3 Apr 2012 22:42:18 +0200 Subject: [PATCH] bij --configure, toon epg source bij elke zender. --- pom.xml | 2 +- src/main/java/org/vanbest/xmltv/Main.java | 28 +++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index d4d35b1..46a350e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ <modelVersion>4.0.0</modelVersion> <groupId>org.vanbest.xmltv.tv_grab_nl_java</groupId> <artifactId>tv_grab_nl_java</artifactId> - <version>0.9.0</version> + <version>0.9.1-SNAPSHOT</version> <dependencies> <dependency> <groupId>net.sf.json-lib</groupId> diff --git a/src/main/java/org/vanbest/xmltv/Main.java b/src/main/java/org/vanbest/xmltv/Main.java index 08278d2..61cc184 100644 --- a/src/main/java/org/vanbest/xmltv/Main.java +++ b/src/main/java/org/vanbest/xmltv/Main.java @@ -172,17 +172,30 @@ public class Main { // public String cacheDbPassword; + Set<String> oldChannels = new HashSet<String>(); + Set<Integer> oldGuides = new HashSet<Integer>(); + for (Channel c: config.channels) { + if (c.enabled) { + oldChannels.add(c.source+"::"+c.id); + oldGuides.add(c.source); + } + } + EPGSourceFactory factory = EPGSourceFactory.newInstance(); int[] sources = factory.getAll(); System.out.println("Please select the TV programme information sources to use"); List<EPGSource> guides = new ArrayList<EPGSource>(); for(int source: sources) { + boolean selected = oldGuides.contains(source); EPGSource guide = factory.createEPGSource(source, config); - System.out.print(" Use \"" + guide.getName() + "\" (Y/N):"); + System.out.print(" Use \"" + guide.getName() + "\" (Y/N, default=" + (selected?"Y":"N")+"):"); while(true) { String s = reader.readLine().toLowerCase(); - if ( s.startsWith("y")) { + if (s.isEmpty()) { + if(selected) guides.add(guide); + break; + } else if (s.startsWith("y")) { guides.add(guide); break; } else if (s.startsWith("n")) { @@ -191,15 +204,6 @@ public class Main { } } - //EPGSource gids = new TvGids(config); - - Set<String> oldChannels = new HashSet<String>(); - for (Channel c: config.channels) { - if (c.enabled) { - oldChannels.add(c.source+"::"+c.id); - } - } - List<Channel> channels = new ArrayList<Channel>(); for(EPGSource guide: guides) { channels.addAll(guide.getChannels()); @@ -210,7 +214,7 @@ public class Main { boolean keep = false; for (Channel c: channels) { boolean selected = oldChannels.contains(c.source+"::"+c.id); - System.out.print("add channel " + c.id + " (" + c.defaultName() + ") [[y]es,[n]o,[a]ll,[none],[k]eep selection (default=" + (selected?"yes":"no") + ")] "); + System.out.print("add channel " + c.getXmltvChannelId() + " (" + c.defaultName() + ") [[y]es,[n]o,[a]ll,[none],[k]eep selection (default=" + (selected?"yes":"no") + ")] "); if (keep) { c.enabled = selected; System.out.println(selected?"Y":"N"); -- 2.39.5