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) {
for (Program program : _recordings.get(result)) {
recordingResult.add(program.asXml());
+ reportedPrograms.add(program);
}
}
}
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);
}
}