From: Erik Brakkee Date: Fri, 24 Mar 2006 13:26:47 +0000 (+0000) Subject: Programs for which there was already an attempt to record them will no X-Git-Tag: wamblee-utils-0.7~1086 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=abd7639aeda13c2b87b724f85278deccbe0acfa4;hp=8c856dc35f912a76b806ff225edf87e07ae90478;p=utils Programs for which there was already an attempt to record them will no longer be mentioned as interesting. --- 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); } }