X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=crawler%2Fkiss%2Fsrc%2Forg%2Fwamblee%2Fcrawler%2Fkiss%2Fmain%2FProgramActionExecutor.java;h=51aef60f1a2148f58300f1c085b642e4028a322f;hb=e1aafb0930f726a00368ce3468a48193d0fb6fac;hp=90fd6e1f04793da4d6d72a765758fedd09488a8a;hpb=36c06c6b445fce1d29cf297fa651460b27b2df6c;p=utils diff --git a/crawler/kiss/src/org/wamblee/crawler/kiss/main/ProgramActionExecutor.java b/crawler/kiss/src/org/wamblee/crawler/kiss/main/ProgramActionExecutor.java index 90fd6e1f..51aef60f 100644 --- a/crawler/kiss/src/org/wamblee/crawler/kiss/main/ProgramActionExecutor.java +++ b/crawler/kiss/src/org/wamblee/crawler/kiss/main/ProgramActionExecutor.java @@ -152,6 +152,8 @@ public class ProgramActionExecutor { public Element getReport() { DocumentFactory factory = DocumentFactory.getInstance(); Element report = factory.createElement("report"); + + Set reportedPrograms = new HashSet(); 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); } }