]> www.vanbest.org Git - tv_grab_nl_java/commitdiff
bij --configure, toon epg source bij elke zender.
authorJan-Pascal van Best <janpascal@vanbest.org>
Tue, 3 Apr 2012 20:42:18 +0000 (22:42 +0200)
committerJan-Pascal van Best <janpascal@vanbest.org>
Tue, 3 Apr 2012 20:42:18 +0000 (22:42 +0200)
pom.xml
src/main/java/org/vanbest/xmltv/Main.java

diff --git a/pom.xml b/pom.xml
index d4d35b164caf9bfac370c2ba697e4ead099c737d..46a350e00de971039f04b7dcde8fd139b25a11d8 100644 (file)
--- 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>
index 08278d2613fca9417f4519514a278ccbd781870a..61cc184e8e8f736a997ab96effb37689f2460db9 100644 (file)
@@ -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");