Fix a bug when there is no <a> in a title (like for Eye-Candy art).
authorFabien Ninoles <fabien@tzone.org>
Sun, 06 Jul 2014 08:54:22 -0400
changeset 12 9d5880ecdb82
parent 11 dc1b075c538a
child 13 7567c5e4db45
Fix a bug when there is no <a> in a title (like for Eye-Candy art).
update-hib.py
--- a/update-hib.py	Sat Mar 29 00:13:35 2014 -0400
+++ b/update-hib.py	Sun Jul 06 08:54:22 2014 -0400
@@ -134,7 +134,10 @@
                 continue
             classes = child["class"] if "class" in child.attrs else []
             if "gameinfo" in classes:
-                self.title = child.find(class_="title").a.string.strip()
+                divTitle = child.find(class_="title")
+                if divTitle.a:
+                    divTitle = divTitle.a
+                self.title = divTitle.string.strip()
             elif "downloads" in classes:
                 logging.debug("Collecting downloadables for %s", self.title)
                 self.downloads.append(Downloads(child))
@@ -198,8 +201,6 @@
         if dl.dltype == "ebook":
             if "MOBI" in dl.attrs:
                 return -1
-            if "HD" in dl.attrs:
-                return 2
             return 1
         raise Exception("Unknown dls type: %r" % (dl,))