Author: jerome
Date: 2009-04-08 19:00:04 +0200 (Wed, 08 Apr 2009)
New Revision: 4418
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/Program.java
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
Log:
* Getting righ day tv program.
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/Program.java
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/Program.java
2009-04-08 15:46:33 UTC (rev 4417)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/Program.java
2009-04-08 17:00:04 UTC (rev 4418)
@@ -24,7 +24,6 @@
public class Program {
private String startTime;
- private String endTime;
private String title;
private String description;
private String channel;
@@ -38,20 +37,13 @@
* @param description : The program description.
* @param channel : The program channel.
*/
- public Program(String title, String startTime, String endTime, String
description, String channel)
+ public Program(String title, String startTime, String description,
String channel)
{
this.title = title;
this.startTime = startTime;
- this.endTime = endTime;
this.description = description;
this.channel = channel;
- //Checking endTime that is not always referenced by all
websites.
- if((this.endTime == null) || this.endTime.contains(" ") ||
this.endTime.equals(""))
- {
- this.endTime = "UNDEFINED";
- }
-
//Checking description that is not always referenced by all
websites.
if((this.description == null) ||
this.description.contains(" ") || this.description.equals("") ||
this.description.equals(" "))
{
@@ -149,35 +141,4 @@
{
return this.startTime;
}
-
-
- /**
- * Set the end time.
- * @param aEndTime
- */
- public void setEndTime(String aEndTime)
- {
- this.endTime = aEndTime;
- }
-
-
- /**
- * Return the program end time.
- * @return
- */
- public String getEndTime()
- {
- return this.endTime;
- }
-
-
- /**
- * Return true is the program has a specified end time.
- * @return
- */
- public boolean hasEndTime()
- {
- return this.endTime != "UNDEFINED";
- }
-
}
Modified:
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
===================================================================
---
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
2009-04-08 15:46:33 UTC (rev 4417)
+++
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
2009-04-08 17:00:04 UTC (rev 4418)
@@ -249,7 +249,51 @@
{
Vector<Program> def = new Vector<Program>();
- System.out.println(page);
+ String temp = page.substring(page.indexOf("</FORM>") +
"</FORM>".length());
+ temp = temp.substring(temp.indexOf("</center>") +
"</center>".length());
+ temp = temp.substring(temp.indexOf("</center></td>") +
"</center></td>".length());
+ temp = temp.substring(temp.indexOf("valign=top>") +
"valign=top>".length());
+
+ String[] split = temp.split("<BR>");
+
+ for(String str : split)
+ {
+ if(!str.contains("</td></tr></table>"))
+ {
+ //Getting start time.
+ String startTime = str.substring(0,
str.indexOf("<B>"));
+ str = str.replace(startTime, "");
+ startTime =
HTMLUtils.HtmlToString(startTime).substring(0, 5);
+
+ //Getting title.
+ String title = str.substring(str.indexOf("<B>")
+ "<B>".length(), str.indexOf("</B>"));
+ str = str.replace(title, "");
+ str = str.substring(str.indexOf("</B>") +
"</B>".length());
+ title = HTMLUtils.HtmlToString(title);
+
+ //Gettin description if it can be found.
+ String description = null;
+
+ if(str.contains("<ul>"))
+ {
+ description =
str.substring(str.indexOf("<ul>") + "<ul>".length(), str.indexOf("</ul>"));
+ str = str.replace(description, "");
+ str = str.substring(9);
+ description =
HTMLUtils.HtmlToString(description);
+ }
+
+ Program p = new Program(title, startTime,
description, channel);
+ //def.add(p);
+
+ if(str.length() > 0)
+ {
+
+ }
+
+ System.out.println(str);
+ }
+ }
+
return def;
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn