<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
- <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java">\r
+ <attributes>\r
+ <attribute name="optional" value="true"/>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">\r
+ <attributes>\r
+ <attribute name="optional" value="true"/>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">\r
+ <attributes>\r
+ <attribute name="maven.pomderived" value="true"/>\r
+ </attributes>\r
+ </classpathentry>\r
<classpathentry kind="output" path="target/classes"/>\r
</classpath>\r
result.put("sport", "Sports");
result.put("theater", "Arts/Culture");
result.put("wetenschap", "Science/Nature");
+ result.put("news", "News");
return result;
}
JSONObject firstSchedule = stationSchedules.getJSONObject(0);
JSONObject station = firstSchedule.getJSONObject("station");
- logger.info("firstschedule: " + firstSchedule.toString());
+ logger.debug("firstschedule: " + firstSchedule.toString());
int id = station.getInt("id");
String name = station.getString("title");
+ // Use the largest available station logo as icon
JSONArray images = station.getJSONArray("images");
String icon = "";
+ int maxSize = 0;
+ for( int j=0; j<images.size(); j++) {
+ JSONObject image = images.getJSONObject(j);
+ if (image.getString("assetType").startsWith("station-logo") &&
+ image.getInt("width")>maxSize) {
+ icon = image.getString("url");
+ maxSize = image.getInt("width");
+ }
+ }
Channel c = Channel.getChannel(getId(), Integer.toString(id), name,
icon);
result.add(c);
for (Channel c : channels) {
URL url = programmeUrl(c, day);
- logger.info("Programme url:" + url);
+ logger.debug("Programme url:" + url);
JSONObject jsonObject = fetchJSON(url);
- logger.info(jsonObject.toString());
+ logger.debug(jsonObject.toString());
JSONArray listings = jsonObject.getJSONArray("listings");
for (int i = 0; i < listings.size(); i++) {
JSONObject listing = listings.getJSONObject(i);
result.startTime = new Date(json.getLong("startTime"));
result.endTime = new Date(json.getLong("endTime"));
JSONObject prog = json.getJSONObject("program");
- result.addTitle(prog.getString("title"));
+ if (prog.containsKey("secondaryTitle")){
+ result.addTitle(prog.getString("secondaryTitle"));
+ } else {
+ result.addTitle(prog.getString("title"));
+ }
+ String description = prog.getString("longDescription");
+ if (description==null || description.isEmpty()) {
+ description = prog.getString("description");
+ if (description==null || description.isEmpty()) {
+ description = prog.getString("shortDescription");
+ }
+ }
+ result.addDescription(description);
+
+ JSONArray cast = prog.getJSONArray("cast");
+ for( int j=0; j<cast.size(); j++) {
+ result.addActor(cast.getString(j));
+ }
+
+ JSONArray directors = prog.getJSONArray("directors");
+ for( int j=0; j<directors.size(); j++) {
+ result.addDirector(directors.getString(j));
+ }
+ JSONArray categories = prog.getJSONArray("categories");
+ for( int j=0; j<categories.size(); j++) {
+ String cat = categories.getJSONObject(j).getString("title");
+ if (!cat.contains("/")) {
+ // Remove things like "drama/drama" and subcategories
+ result.addCategory(config.translateCategory(cat));
+ }
+ }
+ if (prog.containsKey("seriesEpisodeNumber")){
+ String episode = prog.getString("seriesEpisodeNumber");
+ result.addEpisode(episode,"onscreen");
+ }
+ if (prog.containsKey("parentalRating")){
+ String rating = prog.getString("parentalRating");
+ result.addRating("kijkwijzer", "Afgeraden voor kinderen jonger dan "+rating+" jaar");
+ }
/*
// Do this here, because we can only add to these fields. Pity if
// they're updated
*/
public static void main(String[] args) {
Config config = Config.getDefaultConfig();
- Horizon horizon = new Horizon(1, config);
+ Horizon horizon = new Horizon(3, config);
+ horizon.clearCache();
try {
List<Channel> channels = horizon.getChannels();
System.out.println("Channels: " + channels);
descriptions.add(new Title(title, lang));
}
+ public void addEpisode(String episode, String system) {
+ if (episodes == null)
+ episodes = new ArrayList<Episode>();
+ Episode e = new Episode();
+ e.episode = episode;
+ e.system = system;
+ episodes.add(e);
+ }
+
public void addCategory(String category) {
addCategory(category, null);
}
}
}
+ private void writeEpisodeList(List<Episode> episodes, XMLStreamWriter writer)
+ throws XMLStreamException {
+ if (episodes == null)
+ return;
+ for (Episode e: episodes) {
+ writer.writeStartElement("episode");
+ if (e.system != null)
+ writer.writeAttribute("system", e.system);
+ if (e.episode != null)
+ writer.writeCharacters(e.episode);
+ writer.writeEndElement();
+ }
+ }
+
private void writeIconList(List<Icon> icons, XMLStreamWriter writer)
throws XMLStreamException {
if (icons == null)
writeTitleList(categories, "category", writer);
writeIconList(icons, writer);
writeStringList(urls, "url", writer);
+ writeEpisodeList(episodes,writer);
if (video != null) {
writer.writeStartElement("video");
if (!video.present) {
private PreparedStatement clearSourceStatement;
/** The Constant SCHEMA_VERSION. */
- private final static Integer SCHEMA_VERSION = 1;
+ private final static Integer SCHEMA_VERSION = 2;
/** The Constant SCHEMA_KEY. */
private final static String SCHEMA_KEY = "TV_GRAB_NL_JAVA_SCHEMA_VERSION";
// System.out.println("Dropping old table");
stat.execute("DROP TABLE IF EXISTS cache");
// System.out.println("Creating new table");
- stat.execute("CREATE CACHED TABLE IF NOT EXISTS cache (source INTEGER, id VARCHAR(64), date DATE, programme OTHER, PRIMARY KEY (source,id))");
+ stat.execute("CREATE CACHED TABLE IF NOT EXISTS cache (source INTEGER, id VARCHAR(128), date DATE, programme OTHER, PRIMARY KEY (source,id))");
stat.close();
// System.out.println("Writing new schema version to database");
project.description=${project.description}
build.time=${build.time}
org.vanbest.xmltv.epgsource.impl.1=org.vanbest.xmltv.TvGids
-org.vanbest.xmltv.epgsource.impl.2=org.vanbest.xmltv.RTL
\ No newline at end of file
+org.vanbest.xmltv.epgsource.impl.2=org.vanbest.xmltv.RTL
+org.vanbest.xmltv.epgsource.impl.3=org.vanbest.xmltv.Horizon
\ No newline at end of file