From 3e9e8c380632c72c76fe576c0ba7642024023aa4 Mon Sep 17 00:00:00 2001
From: Jan-Pascal van Best <janpascal@vanbest.org>
Date: Fri, 6 Apr 2012 11:25:59 +0200
Subject: [PATCH] Removed mysql dependency; fix for Java6; added some internal
 documentation

---
 .gitignore                                            |  1 +
 pom.xml                                               |  5 -----
 src/main/java/org/vanbest/xmltv/EPGSource.java        |  4 +++-
 src/main/java/org/vanbest/xmltv/EPGSourceFactory.java | 10 ++++++++--
 src/main/java/org/vanbest/xmltv/RTL.java              |  6 ++++--
 5 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/.gitignore b/.gitignore
index e40871a..a1a0d4a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
 /testdb.*
 /cachedb.*
 /tv_grab_nl_java.db.properties
+*.orig
diff --git a/pom.xml b/pom.xml
index 46a350e..74dc9b1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,11 +31,6 @@
 			<artifactId>hsqldb</artifactId>
 			<version>2.2.8</version>
 		</dependency>
-		<dependency>
-			<groupId>mysql</groupId>
-			<artifactId>mysql-connector-java</artifactId>
-			<version>5.1.18</version>
-		</dependency>
 	</dependencies>
 	<build>
 		<plugins>
diff --git a/src/main/java/org/vanbest/xmltv/EPGSource.java b/src/main/java/org/vanbest/xmltv/EPGSource.java
index 2c53e55..f8fbb54 100644
--- a/src/main/java/org/vanbest/xmltv/EPGSource.java
+++ b/src/main/java/org/vanbest/xmltv/EPGSource.java
@@ -14,7 +14,9 @@ public interface EPGSource {
 
 	public int getId();
 	public void setId(int id);
-    public String getName(); // must be static
+    public String getName(); 
+	// All implementing class must declare a
+    // public static final String NAME (e.g tvgids.nl or rtl.nl)
 
 	public List<Channel> getChannels();
 	// Convenience method
diff --git a/src/main/java/org/vanbest/xmltv/EPGSourceFactory.java b/src/main/java/org/vanbest/xmltv/EPGSourceFactory.java
index 31e8acd..bafde35 100644
--- a/src/main/java/org/vanbest/xmltv/EPGSourceFactory.java
+++ b/src/main/java/org/vanbest/xmltv/EPGSourceFactory.java
@@ -46,10 +46,16 @@ public class EPGSourceFactory {
 			} catch (ClassNotFoundException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
-			} catch (ReflectiveOperationException e) {
+			} catch (SecurityException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
-			} catch (SecurityException e) {
+			} catch (NoSuchFieldException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (IllegalArgumentException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (IllegalAccessException e) {
 				// TODO Auto-generated catch block
 				e.printStackTrace();
 			}
diff --git a/src/main/java/org/vanbest/xmltv/RTL.java b/src/main/java/org/vanbest/xmltv/RTL.java
index fcf2583..164a196 100644
--- a/src/main/java/org/vanbest/xmltv/RTL.java
+++ b/src/main/java/org/vanbest/xmltv/RTL.java
@@ -65,8 +65,6 @@ public class RTL extends AbstractEPGSource implements EPGSource  {
 	String[] xmlKeys = {"zendernr", "pgmsoort", "genre", "bijvnwlanden", "ondertiteling", "begintijd", "titel", 
 			"site_path", "wwwadres", "presentatie", "omroep", "eindtijd", "inhoud", "tt_inhoud", "alginhoud", "afl_titel", "kijkwijzer" };
 		
-	//Map<String,Integer> xmlKeyMap = new HashMap<String,Integer>();
-	
 	class RTLException extends Exception {
 		public RTLException(String s) {
 			super(s);
@@ -215,6 +213,7 @@ public class RTL extends AbstractEPGSource implements EPGSource  {
 			prog.endTime = parseTime(date, e.getTextContent());
 		} else if (tag.equals("omroep")) {
 		} else if (tag.equals("kijkwijzer")) {
+			System.out.println("Kijkwijzer: \"" + e.getTextContent() + "\"");
 		} else if (tag.equals("presentatie")) {
 			// A; A en B; A, B, C en D
 			String[] presentatoren = e.getTextContent().split(", | en ");
@@ -228,6 +227,7 @@ public class RTL extends AbstractEPGSource implements EPGSource  {
 		} else if (tag.equals("inhoud")) {
 			prog.addDescription(e.getTextContent());
 		} else if (tag.equals("tt_inhoud")) {
+			prog.addDescription(e.getTextContent());
 			// ignore, is summary of other fields
 		} else if (tag.equals("zendernr")) {
 		} else if (tag.equals("titel")) {
@@ -307,6 +307,8 @@ public class RTL extends AbstractEPGSource implements EPGSource  {
 		super.close();
 	}
 
+	// FIXME probably not correct in all cases, maybe make use 
+	// of the order of the programmes?
 	private Date parseTime(Date date, String time) {
 		Calendar result = Calendar.getInstance();
 		result.setTime(date);
-- 
2.39.5