fixd title text xkcd
[comic-widget] / src / usr / lib / hildon-desktop / comicwidget.py
index 2316017..195789f 100644 (file)
@@ -208,7 +208,7 @@ class ComicDb():
                                print "already at first comic"
                                return
                        print "got " + comicid + " as the one before current..."
-               elif len(earliest) == 10:
+               elif len(str(earliest)) == 10:
                        # date id.
                        dt = string.split(earliest, "-")
                        d = datetime.date(int(dt[0]),int(dt[1]),int(dt[2]))
@@ -482,13 +482,13 @@ class ComicDb():
                                s = f.read()
                                f.close()
                                 # This should be done with regex but...
-                               splt = string.split(s, "<h3>Image URL (for hotlinking/embedding): ", 1)
-                               splt2 = string.split(splt[1], "</h3>", 1)
-                               url = splt2[0]
-                               splt = string.split(splt[0], "<h1>", 1)
-                               splt = string.split(splt[1], "</h1>", 1)
-
+                               splt = string.split(s, 'png" title="', 1)
+                               splt = string.split(splt[1], '" alt="', 1)
                                title = splt[0]
+                               splt = string.split(splt[1], "<h3>Image URL (for hotlinking/embedding): ", 1)
+                               splt = string.split(splt[1], "</h3>", 1)
+                               url = splt[0]
+
 
                        elif comic == 'sinfest':
                                s = f.read()
@@ -631,6 +631,7 @@ class ComicHomePlugin(hildondesktop.HomePluginItem):
                self.keypointer = 0
                if len(self.active_comics) < 1:
                        self.active_comics = ['xkcd']
+               
                self.db = ComicDb(self.active_comics[self.keypointer])
                self.comicname = comics[self.active_comics[self.keypointer]]['name']
                self.set_name = "comicwidget"