From b40bbb4b45779021e7adde416d1319a2562981a2 Mon Sep 17 00:00:00 2001 From: Jan-Pascal van Best Date: Mon, 2 Apr 2012 21:53:56 +0200 Subject: [PATCH] Removed legacy TvGids classes --- .../java/org/vanbest/xmltv/TvGidsChannel.java | 42 --- .../java/org/vanbest/xmltv/TvGidsLegacy.java | 321 ------------------ .../org/vanbest/xmltv/TvGidsProgramme.java | 148 -------- .../vanbest/xmltv/TvGidsProgrammeCache.java | 74 ---- .../vanbest/xmltv/TvGidsProgrammeDetails.java | 153 --------- .../java/org/vanbest/xmltv/XmlTvWriter.java | 238 ------------- 6 files changed, 976 deletions(-) delete mode 100644 src/main/java/org/vanbest/xmltv/TvGidsChannel.java delete mode 100644 src/main/java/org/vanbest/xmltv/TvGidsLegacy.java delete mode 100644 src/main/java/org/vanbest/xmltv/TvGidsProgramme.java delete mode 100644 src/main/java/org/vanbest/xmltv/TvGidsProgrammeCache.java delete mode 100644 src/main/java/org/vanbest/xmltv/TvGidsProgrammeDetails.java delete mode 100644 src/main/java/org/vanbest/xmltv/XmlTvWriter.java diff --git a/src/main/java/org/vanbest/xmltv/TvGidsChannel.java b/src/main/java/org/vanbest/xmltv/TvGidsChannel.java deleted file mode 100644 index 578c70b..0000000 --- a/src/main/java/org/vanbest/xmltv/TvGidsChannel.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -public class TvGidsChannel extends Channel { - - protected TvGidsChannel(String id) { - super(CHANNEL_SOURCE_TVGIDS, id); - } - - static Channel getChannel(String id, String name) { - Channel c = new TvGidsChannel(id); - c.names.add(name); - return c; - } - - static Channel getChannel(String id, String name, String iconUrl) { - Channel c = new TvGidsChannel(id); - c.names.add(name); - c.icons.add(new Icon(iconUrl)); - return c; - } - - public String getXmltvChannelId() { - return id+".tvgids.nl"; - } - -} diff --git a/src/main/java/org/vanbest/xmltv/TvGidsLegacy.java b/src/main/java/org/vanbest/xmltv/TvGidsLegacy.java deleted file mode 100644 index 231fa5d..0000000 --- a/src/main/java/org/vanbest/xmltv/TvGidsLegacy.java +++ /dev/null @@ -1,321 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.MalformedURLException; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import org.vanbest.xmltv.EPGSource.Stats; - - -import net.sf.ezmorph.MorpherRegistry; -import net.sf.ezmorph.ObjectMorpher; -import net.sf.ezmorph.object.DateMorpher; -import net.sf.json.JSON; -import net.sf.json.JSONArray; -import net.sf.json.JSONObject; -import net.sf.json.util.JSONUtils; - -public class TvGidsLegacy { - - static String channels_url="http://www.tvgids.nl/json/lists/channels.php"; - static String programme_base_url="http://www.tvgids.nl/json/lists/programs.php"; - static String detail_base_url = "http://www.tvgids.nl/json/lists/program.php"; - static String html_detail_base_url = "http://www.tvgids.nl/programma/"; - - public static final int MAX_FETCH_TRIES=5; - - static boolean initialised = false; - private Config config; - protected Stats stats = new Stats(); - private TvGidsProgrammeCache cache; - - public TvGidsLegacy(Config config) { - this.config = config; - //this.cache = new TvGidsProgrammeCache(config.cacheFile); - this.cache = new TvGidsProgrammeCache(new File("tv_grab_nl_java.cache")); - if ( ! initialised ) { - init(); - initialised = true; - } - } - - public static void init() { - String[] formats = {"yyyy-MM-dd HH:mm:ss"}; - MorpherRegistry registry = JSONUtils.getMorpherRegistry(); - registry.registerMorpher( new DateMorpher(formats, new Locale("nl"))); - registry.registerMorpher( new ObjectMorpher() { - public Object morph(Object value) { - String s = (String) value; - return org.apache.commons.lang.StringEscapeUtils.unescapeHtml(s); - } - public Class morphsTo() { - return String.class; - } - public boolean supports(Class clazz) { - return clazz == String.class; - } - }, true); - } - - /* (non-Javadoc) - * @see org.vanbest.xmltv.EPGSource#getChannels() - */ - public List getChannels() { - List result = new ArrayList(10); - URL url = null; - try { - url = new URL(channels_url); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - StringBuffer json = new StringBuffer(); - try { - - BufferedReader reader = new BufferedReader( new InputStreamReader( url.openStream())); - - String s; - while ((s = reader.readLine()) != null) json.append(s); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - if (config.logJSON()) System.out.println(json.toString()); - JSONArray jsonArray = JSONArray.fromObject( json.toString() ); - // System.out.println( jsonArray ); - - for( int i=0; i channels, int day) throws Exception { - StringBuilder s = new StringBuilder(programme_base_url); - if (channels.size() < 1) { - throw new Exception("should have at least one channel"); - } - s.append("?channels="); - boolean first = true; - for(Channel i: channels) { - if (first) { - s.append(i.id); - first = false; - } else { - s.append(","+i.id); - } - } - s.append("&day="); - s.append(day); - - return new URL(s.toString()); - } - - public static URL JSONDetailUrl(String id) throws Exception { - StringBuilder s = new StringBuilder(detail_base_url); - s.append("?id="); - s.append(id); - return new URL(s.toString()); - } - - public static URL HTMLDetailUrl(String id) throws Exception { - StringBuilder s = new StringBuilder(html_detail_base_url); - s.append(id); - s.append("/"); - return new URL(s.toString()); - } - - /* (non-Javadoc) - * @see org.vanbest.xmltv.EPGSource#getProgrammes(java.util.List, int, boolean) - */ - public Set getProgrammes1(List channels, int day, boolean fetchDetails) throws Exception { - Set result = new HashSet(); - URL url = programmeUrl(channels, day); - - JSONObject jsonObject = fetchJSON(url); - //System.out.println( jsonObject ); - - for(Channel c: channels) { - JSON ps = (JSON) jsonObject.get(c.id); - if ( ps.isArray() ) { - JSONArray programs = (JSONArray) ps; - for( int i=0; i(.*?):(.*?)"); - Pattern HDPattern = Pattern.compile("HD \\d+[ip]?"); - Pattern kijkwijzerPattern = Pattern.compile("\"(.*?)\""); - - p.details = cache.getDetails(p.db_id); - if ( p.details == null ) { - stats.cacheMisses++; - - URL url = JSONDetailUrl(p.db_id); - JSONObject json = fetchJSON(url); - p.details = (TvGidsProgrammeDetails) JSONObject.toBean(json, TvGidsProgrammeDetails.class); - - url = HTMLDetailUrl(p.db_id); - String clob=fetchURL(url); - //System.out.println("clob:"); - //System.out.println(clob); - Matcher m = progInfoPattern.matcher(clob); - if (m.find()) { - String progInfo = m.group(); - //System.out.println("progInfo"); - //System.out.println(progInfo); - Matcher m2 = infoLinePattern.matcher(progInfo); - while (m2.find()) { - //System.out.println(" infoLine: " + m2.group()); - //System.out.println(" key: " + m2.group(1)); - //System.out.println(" value: " + m2.group(2)); - String key = m2.group(1).toLowerCase(); - String value = m2.group(2); - if (key.equals("bijzonderheden")) { - String[] list = value.split(","); - for( String item: list) { - if (item.toLowerCase().contains("teletekst")) { - p.details.subtitle_teletekst = true; - } else if (item.toLowerCase().contains("breedbeeld")) { - p.details.breedbeeld = true; - } else if (value.toLowerCase().contains("zwart")) { - p.details.blacknwhite = true; - } else if (value.toLowerCase().contains("stereo")) { - p.details.stereo = true; - } else if (value.toLowerCase().contains("herhaling")) { - p.details.herhaling = true; - } else { - Matcher m3 = HDPattern.matcher(value); - if (m3.find()) { - p.details.quality = m3.group(); - } else { - if (!config.quiet) System.out.println(" Unknown value in 'bijzonderheden': " + item); - } - } - } - } else { - // ignore other keys for now - } - Matcher m3 = kijkwijzerPattern.matcher(progInfo); - List kijkwijzer = new ArrayList(); - while (m3.find()) { - kijkwijzer.add(m3.group(1)); - } - if (!kijkwijzer.isEmpty()) { - // log.debug() - // System.out.println(" (kijkwijzer): " + p.details.kijkwijzer); - // System.out.println(" kijkwijzer: " + kijkwijzer); - } - } - } - - p.details.fixup(p, config.quiet); - cache.add(p.db_id, p.details); - } else { - stats.cacheHits++; - } - } -} diff --git a/src/main/java/org/vanbest/xmltv/TvGidsProgramme.java b/src/main/java/org/vanbest/xmltv/TvGidsProgramme.java deleted file mode 100644 index b98568c..0000000 --- a/src/main/java/org/vanbest/xmltv/TvGidsProgramme.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -import java.util.Date; -import org.apache.commons.lang.StringEscapeUtils; - -public class TvGidsProgramme { - public String getDb_id() { - return db_id; - } - - public void setDb_id(String db_id) { - this.db_id = db_id; - } - - public String getTitel() { - return titel; - } - - public void setTitel(String titel) { - this.titel = titel; - } - - public String getGenre() { - return genre; - } - - public void setGenre(String genre) { - this.genre = genre; - } - - public String getSoort() { - return soort; - } - - public void setSoort(String soort) { - this.soort = soort; - } - - public String getKijkwijzer() { - return kijkwijzer; - } - - public void setKijkwijzer(String kijkwijzer) { - this.kijkwijzer = kijkwijzer; - } - - public String getArtikel_id() { - return artikel_id; - } - - public void setArtikel_id(String artikel_id) { - this.artikel_id = artikel_id; - } - - public Date getDatum_start() { - return datum_start; - } - - public void setDatum_start(Date datum_start) { - this.datum_start = datum_start; - } - - public Date getDatum_end() { - return datum_end; - } - - public void setDatum_end(Date datum_end) { - this.datum_end = datum_end; - } - - public boolean isIs_highlight() { - return is_highlight; - } - - public void setIs_highlight(boolean is_highlight) { - this.is_highlight = is_highlight; - } - - public String getHighlight_afbeelding() { - return highlight_afbeelding; - } - - public void setHighlight_afbeelding(String highlight_afbeelding) { - this.highlight_afbeelding = highlight_afbeelding; - } - - public String getHighlight_content() { - return highlight_content; - } - - public void setHighlight_content(String highlight_content) { - this.highlight_content = highlight_content; - } - - String db_id; - String titel; - String genre; - String soort; - String kijkwijzer; - String artikel_id; - Date datum_start; - Date datum_end; - boolean is_highlight; - String highlight_afbeelding; - String highlight_content; - TvGidsProgrammeDetails details = null; - Channel channel = null; - - public void fixup(Config config) { - titel = titel==null?"":StringEscapeUtils.unescapeHtml(titel); - genre = genre==null?"":StringEscapeUtils.unescapeHtml(genre); - soort = soort==null?"":StringEscapeUtils.unescapeHtml(soort); - highlight_content = highlight_content==null?"":StringEscapeUtils.unescapeHtml(highlight_content); - genre = config.translateCategory(genre); - } - - public String toString() { - StringBuffer s = new StringBuffer(); - s.append("id: " + db_id + ";"); - s.append("titel: " + titel + ";"); - s.append("genre: " + genre + ";"); - s.append("soort: " + soort + ";"); - s.append("kijkwijzer: " + kijkwijzer+ ";"); - s.append("artikel_id: " + artikel_id + ";"); - s.append("datum_start: " + datum_start + ";"); - s.append("datum_end: " + datum_end + ";"); - if (details != null) s.append("details:" + details.toString() ); - s.append("\n"); - - return s.toString(); - } -} diff --git a/src/main/java/org/vanbest/xmltv/TvGidsProgrammeCache.java b/src/main/java/org/vanbest/xmltv/TvGidsProgrammeCache.java deleted file mode 100644 index 90afc63..0000000 --- a/src/main/java/org/vanbest/xmltv/TvGidsProgrammeCache.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InvalidClassException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.io.FileUtils; - -public class TvGidsProgrammeCache { - private File cacheFile; - private Map cache; - - public TvGidsProgrammeCache(File cacheFile) { - this.cacheFile = cacheFile; - if (cacheFile.canRead()) { - try { - cache = (Map) new ObjectInputStream( new FileInputStream( cacheFile ) ).readObject(); - } catch (InvalidClassException e) { - // TODO Auto-generated catch block - cache = new HashMap(); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - cache = new HashMap(); - } catch (FileNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - cache = new HashMap(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - cache = new HashMap(); - } - } else { - cache = new HashMap(); - } - // FileUtils.forceMkdir(root); - } - - public TvGidsProgrammeDetails getDetails(String id) { - return cache.get(id); - } - - public void add(String id, TvGidsProgrammeDetails d) { - cache.put(id, d); - } - - public void close() throws FileNotFoundException, IOException { - new ObjectOutputStream( new FileOutputStream(cacheFile)).writeObject(cache); - } -} diff --git a/src/main/java/org/vanbest/xmltv/TvGidsProgrammeDetails.java b/src/main/java/org/vanbest/xmltv/TvGidsProgrammeDetails.java deleted file mode 100644 index cde3751..0000000 --- a/src/main/java/org/vanbest/xmltv/TvGidsProgrammeDetails.java +++ /dev/null @@ -1,153 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -import java.io.Serializable; - -import org.apache.commons.lang.StringEscapeUtils; - -public class TvGidsProgrammeDetails implements Serializable { - String db_id; - String titel; - String datum; - String btijd; - String etijd; - String synop; - String kijkwijzer; - String genre; - String presentatie; - String acteursnamen_rolverdeling; - String regisseur; - String zender_id; - public boolean subtitle_teletekst = false; - public boolean stereo = false; - public boolean blacknwhite = false; - public boolean breedbeeld = false; - public String quality = null; - public boolean herhaling = false; - - public void fixup(TvGidsProgramme p, boolean quiet) { - titel = titel==null?"":StringEscapeUtils.unescapeHtml(titel); - genre = genre==null?"":StringEscapeUtils.unescapeHtml(genre); - synop = synop==null?"":StringEscapeUtils.unescapeHtml(synop); - synop = this.synop.replaceAll("
", " "). - replaceAll("
", " "). - replaceAll("

", " "). - replaceAll("

", " "). - replaceAll("", " "). - replaceAll("", " "). - replaceAll("", " "). - replaceAll("", " "). - trim(); - if (synop.isEmpty() && (!genre.toLowerCase().equals("movies") && !genre.toLowerCase().equals("film"))) { - String[] parts = p.titel.split("[[:space:]]*:[[:space:]]*", 2); - if (parts.length >= 2 ) { - if (!quiet) { - System.out.println("Splitting title from \"" + p.titel + "\" to: \"" + parts[0].trim() + "\"; synop: \"" + parts[1].trim() + "\""); - } - titel = parts[0].trim(); - p.titel = titel; - synop = parts[1].trim(); - } - } - presentatie = presentatie==null?"":StringEscapeUtils.unescapeHtml(presentatie); - acteursnamen_rolverdeling = acteursnamen_rolverdeling==null?"":StringEscapeUtils.unescapeHtml(acteursnamen_rolverdeling); - regisseur = regisseur==null?"":StringEscapeUtils.unescapeHtml(regisseur); - } - - public String getDb_id() { - return db_id; - } - public void setDb_id(String db_id) { - this.db_id = db_id; - } - public String getTitel() { - return titel; - } - public void setTitel(String titel) { - this.titel = titel; - } - public String getDatum() { - return datum; - } - public void setDatum(String datum) { - this.datum = datum; - } - public String getBtijd() { - return btijd; - } - public void setBtijd(String btijd) { - this.btijd = btijd; - } - public String getEtijd() { - return etijd; - } - public void setEtijd(String etijd) { - this.etijd = etijd; - } - public String getSynop() { - return synop; - } - public void setSynop(String synop) { - this.synop = synop; - } - public String getKijkwijzer() { - return kijkwijzer; - } - public void setKijkwijzer(String kijkwijzer) { - this.kijkwijzer = kijkwijzer; - } - public String getGenre() { - return genre; - } - public void setGenre(String genre) { - this.genre = genre; - } - public String getPresentatie() { - return presentatie; - } - public void setPresentatie(String presentatie) { - this.presentatie = presentatie; - } - public String getActeursnamen_rolverdeling() { - return acteursnamen_rolverdeling; - } - public void setActeursnamen_rolverdeling(String acteursnamen_rolverdeling) { - this.acteursnamen_rolverdeling = acteursnamen_rolverdeling; - } - public String getRegisseur() { - return regisseur; - } - public void setRegisseur(String regisseur) { - this.regisseur = regisseur; - } - public String getZender_id() { - return zender_id; - } - public void setZender_id(String zender_id) { - this.zender_id = zender_id; - } - @Override - public String toString() { - return "ProgrammeDetails [db_id=" + db_id + ", titel=" + titel - + ", datum=" + datum + ", btijd=" + btijd + ", etijd=" + etijd - + ", synop=" + synop + ", kijkwijzer=" + kijkwijzer - + ", genre=" + genre + ", presentatie=" + presentatie - + ", acteursnamen_rolverdeling=" + acteursnamen_rolverdeling - + ", regisseur=" + regisseur + ", zender_id=" + zender_id + "]"; - } -} diff --git a/src/main/java/org/vanbest/xmltv/XmlTvWriter.java b/src/main/java/org/vanbest/xmltv/XmlTvWriter.java deleted file mode 100644 index e474631..0000000 --- a/src/main/java/org/vanbest/xmltv/XmlTvWriter.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.vanbest.xmltv; - -/* - Copyright (c) 2012 Jan-Pascal van Best - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - The full license text can be found in the LICENSE file. -*/ - -import java.io.OutputStream; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Collection; -import java.util.List; - -import javax.xml.stream.FactoryConfigurationError; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.stream.XMLOutputFactory; -import javax.xml.stream.XMLEventFactory; -import javax.xml.stream.XMLStreamException; - - -public class XmlTvWriter { - - private XMLStreamWriter writer; - private XMLEventFactory eventFactory; - private Config config; - - public XmlTvWriter(OutputStream os, Config config) throws XMLStreamException, FactoryConfigurationError { - this.config = config; - this.writer = XMLOutputFactory.newInstance().createXMLStreamWriter(os); - this.eventFactory = XMLEventFactory.newInstance(); - - writer.writeStartDocument(); - writer.writeCharacters("\n"); - writer.writeDTD(""); - writer.writeCharacters("\n"); - writer.writeStartElement("tv"); - writer.writeAttribute("generator-info-url","http://github.com/janpascal/tv_grab_nl_java"); - writer.writeAttribute("source-info-url", "http://tvgids.nl/"); - writer.writeAttribute("source-info-name", "TvGids.nl"); - writer.writeAttribute("generator-info-name", "tv_grab_nl_java release "+config.project_version); - writeln(); - } - - public void writeln() throws XMLStreamException { - writer.writeCharacters(System.getProperty("line.separator")); - } - - public void writeChannels(List channels) throws XMLStreamException { - for(Channel c: channels) { - if (!c.enabled) continue; - c.serialize(writer); - } - } - - /* TODO: - * boolean is_highlight; - * String highlight_afbeelding; - * String highlight_content; - * soort - * artikel_id ??? - * - */ - public void writePrograms(Collection programs) throws XMLStreamException { - DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss Z"); - for(TvGidsProgramme p: programs) { - writer.writeStartElement("programme"); - writer.writeAttribute("start", df.format(p.datum_start)); - writer.writeAttribute("stop", df.format(p.datum_end)); - writer.writeAttribute("channel", ""+p.channel.getXmltvChannelId()); - writeln(); - - writer.writeStartElement("title"); - writer.writeAttribute("lang", "nl"); - writer.writeCharacters(p.titel); - writer.writeEndElement(); - writeln(); - - if(p.details.synop != null && ! p.details.synop.isEmpty()) { - writer.writeStartElement("desc"); - writer.writeAttribute("lang", "nl"); - writer.writeCharacters(p.details.synop); - writer.writeEndElement(); - writeln(); - } - - if (p.details != null) { - if ( p.is_highlight) { - //System.out.println("Highlight"); - //System.out.println(" " + p.highlight_afbeelding); - //System.out.println(" " + p.highlight_content); - } else { - if (p.highlight_afbeelding!= null && !p.highlight_afbeelding.isEmpty()) { - //System.out.println("highlight_afbeelding: " + p.highlight_afbeelding); - } - if (p.highlight_content!= null && !p.highlight_content.isEmpty()) { - //System.out.println("highlight_content: " + p.highlight_content); - } - } - if ( (p.details.presentatie != null && !p.details.presentatie.isEmpty()) || - (p.details.regisseur != null && !p.details.regisseur.isEmpty()) || - (p.details.acteursnamen_rolverdeling != null && !p.details.acteursnamen_rolverdeling.isEmpty()) - ) { - writer.writeStartElement("credits"); - if (p.details.regisseur != null && !p.details.regisseur.isEmpty()) { - String[] parts = p.details.regisseur.split(","); - for (String s: parts) { - writer.writeStartElement("director"); - writer.writeCharacters(s.trim()); - writer.writeEndElement(); - } - } - if (p.details.acteursnamen_rolverdeling != null && !p.details.acteursnamen_rolverdeling.isEmpty()) { - String[] parts = p.details.acteursnamen_rolverdeling.split(","); - for (String s: parts) { - writer.writeStartElement("actor"); - writer.writeCharacters(s.trim()); - writer.writeEndElement(); - } - } - if (p.details.presentatie != null && !p.details.presentatie.isEmpty()) { - String[] parts = p.details.presentatie.split(","); - for (String s: parts) { - writer.writeStartElement("presenter"); - writer.writeCharacters(s.trim()); - writer.writeEndElement(); - } - } - writer.writeEndElement(); - writeln(); - } - writer.writeStartElement("category"); - writer.writeAttribute("lang", "en"); - writer.writeCharacters(p.genre); - writer.writeEndElement(); - writeln(); - - if (p.details.blacknwhite || p.details.breedbeeld) { - writer.writeStartElement("video"); - if (p.details.blacknwhite) { - writer.writeStartElement("colour"); - writer.writeCharacters("no"); - writer.writeEndElement(); - } - if (p.details.breedbeeld) { - writer.writeStartElement("aspect"); - writer.writeCharacters("16:9"); - writer.writeEndElement(); - } - if (p.details.quality != null) { - writer.writeStartElement("quality"); - writer.writeCharacters(p.details.quality); - writer.writeEndElement(); - } - writer.writeEndElement(); - writeln(); - } - - if (p.details.stereo) { - writer.writeStartElement("audio"); - writer.writeStartElement("stereo"); - writer.writeCharacters("stereo"); - writer.writeEndElement(); - writer.writeEndElement(); - writeln(); - } - - if (p.details.herhaling) { - writer.writeEmptyElement("previously-shown"); - } - - if (p.details.subtitle_teletekst) { - writer.writeStartElement("subtitles"); - writer.writeAttribute("type", "teletext"); - writer.writeEndElement(); - writeln(); - } - - /* TODO: Icon attribuut gebruiken? - */ - if (p.details.kijkwijzer != null && !p.details.kijkwijzer.isEmpty()) { - writer.writeStartElement("rating"); - writer.writeAttribute("system", "kijkwijzer"); - writer.writeStartElement("value"); - for (int i=0; i