Fixed updating issues
authorYves Marcoz <yves@marcoz.org>
Wed, 24 Nov 2010 06:58:43 +0000 (22:58 -0800)
committerYves Marcoz <yves@marcoz.org>
Wed, 24 Nov 2010 06:58:43 +0000 (22:58 -0800)
src/qml/common/ConfirmationMessage.qml
src/rss_sqlite.py

index 1a5f1f8..eda34d0 100644 (file)
@@ -31,7 +31,8 @@ Rectangle {
     Button {
         id: ok
         text: qsTr("OK")
-        anchors.left: parent.left; anchors.margins: 5; y: 3; width: 80; height: 60
+        width: parent.width/2 - 10;
+        anchors.left: parent.left; anchors.margins: 5; y: 3; height: 60
         anchors.top: question.bottom
         //anchors.bottom: parent.bottom
         onClicked: confirmationMessage.okClicked()
@@ -40,7 +41,8 @@ Rectangle {
     Button {
         id: cancel
         text: qsTr("Cancel")
-        anchors.right: parent.right; anchors.margins: 5; y: 3; width: 80; height: 60
+        width: parent.width/2 - 10;
+        anchors.right: parent.right; anchors.margins: 5; y: 3; height: 60
         anchors.top: question.bottom
         //anchors.bottom: parent.bottom
         anchors.left: ok.right
index 0b1aae1..e0f7e42 100644 (file)
@@ -149,16 +149,17 @@ class Feed:
                           import traceback
                           traceback.print_exc()
                           print "Error downloading image %s" % img
-                   tmpEntry["contentLink"] = configdir+self.key+".d/"+id+".html"
-                   file = open(tmpEntry["contentLink"], "w")
-                   file.write(soup.prettify())
-                   file.close()
-                   if id in ids:
-                       self.db.execute("UPDATE feed SET updated=? WHERE id=?;", (currentTime, id) )
-                       self.db.commit()
-                   else:
-                       values = (id, tmpEntry["title"], tmpEntry["contentLink"], tmpEntry["date"], currentTime, tmpEntry["link"], 0)
-                       self.db.execute("INSERT INTO feed (id, title, contentLink, date, updated, link, read) VALUES (?, ?, ?, ?, ?, ?, ?);", values)
+               tmpEntry["contentLink"] = configdir+self.key+".d/"+id+".html"
+               file = open(tmpEntry["contentLink"], "w")
+               file.write(soup.prettify())
+               file.close()
+               if id in ids:
+                   self.db.execute("UPDATE feed SET updated=? WHERE id=?;", (currentTime, id) )
+                   self.db.commit()
+               else:
+                   values = (id, tmpEntry["title"], tmpEntry["contentLink"], tmpEntry["date"], currentTime, tmpEntry["link"], 0)
+                   self.db.execute("INSERT INTO feed (id, title, contentLink, date, updated, link, read) VALUES (?, ?, ?, ?, ?, ?, ?);", values)
+                   self.db.commit()
 #               else:
 #                   try:
 #                       self.db.execute("UPDATE feed SET updated=? WHERE id=?;", (currentTime, id) )
@@ -251,7 +252,11 @@ class Feed:
         if(entry["id"] != None):
             return getId(str(entry["id"]))
         else:
-            return getId(str(entry["date"]) + str(entry["title"]))
+            try:
+                return getId(str(entry["date"]) + str(entry["title"]))
+            except:
+                #print entry["title"]
+                return getId(str(entry["date"]))
     
     def getIds(self, onlyUnread=False):
         if onlyUnread:
@@ -492,10 +497,14 @@ class Listing:
         except:
             modified = None
         (updateTime, etag, modified) = feed.updateFeed(self.configdir, url, etag, modified, expiryTime, proxy, imageCache)
+        if modified==None:
+            modified="None"
+        else:
+            modified=str(tuple(modified))
         if updateTime > 0:
-            db.execute("UPDATE feeds SET updateTime=?, etag=?, modified=? WHERE id=?;", (updateTime, etag, str(tuple(modified)), key) )
+            db.execute("UPDATE feeds SET updateTime=?, etag=?, modified=? WHERE id=?;", (updateTime, etag, modified, key) )
         else:
-            db.execute("UPDATE feeds SET etag=?, modified=? WHERE id=?;", (etag, str(tuple(modified)), key) )
+            db.execute("UPDATE feeds SET etag=?, modified=? WHERE id=?;", (etag, modified, key) )
         db.commit()
         self.updateUnread(key, db=db)