Programs for which there was already an attempt to record them will no
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 24 Mar 2006 13:26:47 +0000 (13:26 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Fri, 24 Mar 2006 13:26:47 +0000 (13:26 +0000)
longer be mentioned as interesting.

crawler/kiss/src/org/wamblee/crawler/kiss/main/ProgramActionExecutor.java

index 90fd6e1f04793da4d6d72a765758fedd09488a8a..51aef60f1a2148f58300f1c085b642e4028a322f 100644 (file)
@@ -152,6 +152,8 @@ public class ProgramActionExecutor {
     public Element getReport() {
         DocumentFactory factory = DocumentFactory.getInstance();
         Element report = factory.createElement("report");
+        
+        Set<Program> reportedPrograms = new HashSet<Program>();
 
         for (RecordingResult result : RecordingResult.values()) {
             if (_recordings.get(result).size() > 0) {
@@ -160,6 +162,7 @@ public class ProgramActionExecutor {
 
                 for (Program program : _recordings.get(result)) {
                     recordingResult.add(program.asXml());
+                    reportedPrograms.add(program);
                 }
             }
         }
@@ -173,7 +176,16 @@ public class ProgramActionExecutor {
                     categoryElem.addAttribute("name", category);
                 }
                 for (Program program : _interestingShows.get(category)) {
-                    categoryElem.add(program.asXml());
+                    if ( !reportedPrograms.contains(program)) {
+                        categoryElem.add(program.asXml());
+                    } else { 
+                        LOG.info("Category '" + category + "', program " + program + " already reported");
+                    }
+                }
+                if ( categoryElem.elements().size() == 0 ) {
+                    // Remove empty category element. 
+                    LOG.info("Removing element for category '" + category + "'");
+                    interesting.remove(categoryElem);
                 }
             }