Author: jerome
Date: 2009-04-09 15:32:23 +0200 (Thu, 09 Apr 2009)
New Revision: 4446

Modified:
   
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/gadget/Configuration.java
   
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
Log:
* Finished prototype ( still have to add po template and helps template ).

Modified: 
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/gadget/Configuration.java
===================================================================
--- 
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/gadget/Configuration.java
   2009-04-09 12:59:22 UTC (rev 4445)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/gadget/Configuration.java
   2009-04-09 13:32:23 UTC (rev 4446)
@@ -25,7 +25,7 @@
 
 public class Configuration extends SimpleGadgetConfiguration{
        
-       private String channel = "ARTE";
+       private String channel = "RTL-TVI";
        private boolean giveProgramDescription = true;
        private boolean giveMorning = true;
        private boolean giveAfternoon = true;

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-09 12:59:22 UTC (rev 4445)
+++ 
software_suite_v2/software/gadgets/tuxdroid-gadget-programsTV/trunk/tuxdroid-gadget-programsTV/src/com/kysoh/tvPrograms/programs/SimplePrograms.java
        2009-04-09 13:32:23 UTC (rev 4446)
@@ -268,88 +268,33 @@
                
                for(String str : split)
                {
-                       /*//Handling possible error.
-                       if(str.contains("<img src=\""))
+                       if(str.contains("<B>"))
                        {
-                               int idx = str.indexOf("<img src=\"");
-                               int endIdx = str.indexOf(">", idx) + 1;
-                               String rpl = str.substring(idx, endIdx);
-                               str = str.replace(rpl, "");
-                       }
-                       
-                       if(!str.contains("</td></tr></table>"))
-                       {       
-                               if(str.contains("<B>"))
+                               String startTime = str.substring(0, 
str.indexOf("<B>"));
+                               String title = str.substring(str.indexOf("<B>") 
+ "<B>".length(), str.indexOf("</B>"));
+                               String description = null;
+                               if(str.contains("<ul>"))
                                {
-                                       while(str.contains("<B>"))
-                                       {
-                                               String rpl = "";
-                                               
-                                               //Get start time for next str 
entry.
-                                               String startTime = 
str.substring(0, str.indexOf("<B>"));
-                                               
-                                               rpl += startTime;
-                                               startTime = 
HTMLUtils.HtmlToString(startTime).substring(0, 5); 
-                                               
-                                               //Get title.
-                                               String title = 
str.substring(str.indexOf("<B>"), str.indexOf("</B>") + "</B>".length());
-                                               
-                                               rpl += title;
-                                               
-                                               title = title.replace("<B>", 
"");
-                                               title = title.replace("</B>", 
"");
-                                               title = 
HTMLUtils.HtmlToString(title);
-                                               
-                                               
-                                               title = this.filter(title);
-                                               
-                                               //Getting description if it can 
be found.
-                                               String description = null;
-                                               
-                                               if(str.contains("<ul>") && 
str.contains("</ul>"))
-                                               {
-                                                       int idx = 
str.indexOf("<ul>");
-                                                       int endIdx = 
str.indexOf("</ul>") + "</ul>".length();
-                                                       
-                                                       try
-                                                       {
-                                                               description = 
str.substring(idx, endIdx);
-                                                       }
-                                                       
catch(StringIndexOutOfBoundsException endString)
-                                                       {
-                                                               description = 
str.substring(0, endIdx);                                                       
  
-                                                       }
-                                                       
-                                                       str = 
str.replace(description, "");
-                                                       
-                                                       
-                                                       
System.out.println(description);
-                                                       
-                                                       description = 
description.replace("<ul>", "");
-                                                       description = 
description.replace("</ul>", "");
-                                                       description = 
HTMLUtils.HtmlToString(description);
-                                                       
-                                                       description = 
this.filter(description);
-                                               }
-                                               
-                                               try
-                                               {
-                                                       Program p = new 
Program(title, startTime, description, channel);
-                                                       def.add(p);
-                                               }
-                                               
-                                               catch(Exception titleError)
-                                               {
-                                                       ;
-                                               }
-                                               
-                                               str = str.replace(rpl, "");
-                                       }
+                                       description = 
str.substring(str.indexOf("<ul>") + "<ul>".length());
                                }
-                       }*/
-                       if(str.contains("<B>"))
-                       {
-                               System.out.println(str);
+                               
+                               startTime = startTime.substring(0, 5);
+                               title = this.filter(title);
+                               
+                               if(description != null)
+                               {
+                                       description = this.filter(description);
+                               }
+                               
+                               try 
+                               {
+                                       Program newToGrid = new Program(title, 
startTime, description, this.channel);
+                                       def.add(newToGrid);
+                               } 
+                               catch (Exception e) 
+                               {
+                                       e.printStackTrace();
+                               }
                        }
                }
                
@@ -364,6 +309,8 @@
         */
        private String filter(String baseString)
        {
+               baseString = HTMLUtils.HtmlToString(baseString);
+               
                baseString = baseString.replace("&", "&&");
                baseString = baseString.replace("<br>", "");
                baseString = baseString.replace("\\", "");
@@ -372,6 +319,7 @@
                baseString = baseString.replace("</A>", "");
                baseString = baseString.replace("</I>", "");
                baseString = baseString.replace("<I>", "");
+               baseString = baseString.replace("@", "à");
                
                if(baseString.contains("<a href="))
                {


------------------------------------------------------------------------------
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

Reply via email to