From: Jan-Pascal van Best Date: Tue, 3 Apr 2012 20:42:18 +0000 (+0200) Subject: bij --configure, toon epg source bij elke zender. X-Git-Tag: 0.9.1~9 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=abcc2cf4f1d213887efe3438b09ad9da66f36586;p=tv_grab_nl_java bij --configure, toon epg source bij elke zender. --- diff --git a/pom.xml b/pom.xml index d4d35b1..46a350e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.vanbest.xmltv.tv_grab_nl_java tv_grab_nl_java - 0.9.0 + 0.9.1-SNAPSHOT net.sf.json-lib 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 oldChannels = new HashSet(); + Set oldGuides = new HashSet(); + 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 guides = new ArrayList(); 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 oldChannels = new HashSet(); - for (Channel c: config.channels) { - if (c.enabled) { - oldChannels.add(c.source+"::"+c.id); - } - } - List channels = new ArrayList(); 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");