From: Jan-Pascal van Best Date: Wed, 25 Apr 2012 16:19:21 +0000 (+0200) Subject: RTL: Build from alginhoud and inhoud, use tt_inhoud if both X-Git-Tag: 0.9.3~3 X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=9926464090dc5d7ffbeaef4055a91868a3816ef3;p=tv_grab_nl_java RTL: Build from alginhoud and inhoud, use tt_inhoud if both others are empty. Fixes: #2 --- diff --git a/pom.xml b/pom.xml index ee76e54..08ef1b1 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.vanbest.xmltv.tv_grab_nl_java tv_grab_nl_java - 0.9.2 + 0.9.3-SNAPSHOT net.sf.json-lib diff --git a/src/main/java/org/vanbest/xmltv/RTL.java b/src/main/java/org/vanbest/xmltv/RTL.java index f0856ff..a1e465b 100644 --- a/src/main/java/org/vanbest/xmltv/RTL.java +++ b/src/main/java/org/vanbest/xmltv/RTL.java @@ -91,6 +91,12 @@ public class RTL extends AbstractEPGSource implements EPGSource { this.prevStartTime = null; } } + + class DescStatus { + String inhoud; + String alginhoud; + String tt_inhoud; + } public RTL(int sourceId, Config config) { super(sourceId, config); @@ -187,7 +193,8 @@ public class RTL extends AbstractEPGSource implements EPGSource { System.out.println("Unknown attributes for RTL detail root node"); } NodeList nodes = root.getChildNodes(); - for( int i=0; i"); + //System.out.print("n"); + //System.out.println("Date: "+prog.startTime + "; title: "+ prog.getFirstTitle()); + } + description.append(descStatus.inhoud); + //System.out.print("B"); + } + if (description.length()==0 && descStatus.tt_inhoud!=null) { + description.append(descStatus.tt_inhoud); + //System.out.print("C"); + //System.out.println("Date: "+prog.startTime + "; title: "+ prog.getFirstTitle()); + } + // ignore tt_inhoud since it is almost always a summary of the above and other fields + prog.addDescription(description.toString()); } - private void handleNode(Programme prog, DateStatus dateStatus, Node n) throws RTLException, DOMException, SQLException { + private void handleNode(Programme prog, DateStatus dateStatus, DescStatus descStatus, Node n) throws RTLException, DOMException, SQLException { if (n.getNodeType() != Node.ELEMENT_NODE) { throw new RTLException("Ignoring non-element node " + n.getNodeName()); } @@ -265,11 +293,11 @@ public class RTL extends AbstractEPGSource implements EPGSource { } else if (tag.equals("wwwadres")) { prog.addUrl(e.getTextContent()); } else if (tag.equals("alginhoud")) { - prog.addDescription(e.getTextContent()); + descStatus.alginhoud = e.getTextContent(); } else if (tag.equals("inhoud")) { - prog.addDescription(e.getTextContent()); + descStatus.inhoud = e.getTextContent(); } else if (tag.equals("tt_inhoud")) { - prog.addDescription(e.getTextContent()); + descStatus.tt_inhoud = e.getTextContent(); // ignore, is summary of other fields } else if (tag.equals("zendernr")) { } else if (tag.equals("titel")) {