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