URL url = new URL(buf.toString());
HttpURLConnection con = (HttpURLConnection) url.openConnection();
InputStream in = con.getInputStream();
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
Matcher matcher;
Pattern pattern = Pattern.compile("<tr><td>(\\d+):(\\d+)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td></tr>");
String line = reader.readLine();
while (line != null) {
matcher = pattern.matcher(line);
if (matcher.find()) {
// System.out.println("h: "+matcher.group(1)+"; m: "+matcher.group(2)+"; title: "+matcher.group(3)+"; short: "+matcher.group(4)+"; desc: "+matcher.group(5));
int h = Integer.parseInt(matcher.group(1));
int m = Integer.parseInt(matcher.group(2));
String title = matcher.group(3);
String shortInfo = matcher.group(4);
String description = matcher.group(5);
ProgramFrame frame = new ProgramFrame();
frame.addProgramField(ProgramField.create(ProgramFieldType.START_TIME_TYPE, h * 60 + m));
frame.addProgramField(ProgramField.create(ProgramFieldType.TITLE_TYPE, title));
frame.addProgramField(ProgramField.create(ProgramFieldType.SHORT_DESCRIPTION_TYPE, shortInfo));
frame.addProgramField(ProgramField.create(ProgramFieldType.DESCRIPTION_TYPE, description));
dispatcher.dispatchProgramFrame(frame, date);
}
line = reader.readLine();
}
}