Permalink
Browse files

Added delicious feeds

  • Loading branch information...
1 parent 186c9bd commit 9b4b3f3f0eeb310f29d1422099ffdde885132dcd @sharms committed Aug 4, 2010
Showing with 18 additions and 0 deletions.
  1. +17 −0 homepage.py
  2. +1 −0 templates/index.html
View
@@ -56,6 +56,7 @@ def populate_database():
load_github()
load_wordpress()
load_picasa()
+ load_delicious()
def data_is_stale():
"""Find the last entry in the sqlite database to determine if we need to
@@ -119,6 +120,22 @@ def load_wordpress():
g.db.commit()
+def load_delicious():
+ delicious = feedparser.parse("http://feeds.delicious.com/v2/rss/stevenharms?count=10")
+ g.db.cursor().execute('DELETE FROM entries WHERE source = "delicious"')
+
+ for entry in delicious.entries:
+ g.db.cursor().execute('INSERT INTO entries VALUES (?, ?, ?, ?, ?, ?, ?)',
+ (None,
+ entry['link'],
+ "http://www.sharms.org/static/page_white_link.png",
+ entry['title'],
+ "wordpress",
+ datetime.strptime(entry['updated'][:-6], '%a, %d %b %Y %H:%M:%S'),
+ datetime.now()))
+
+ g.db.commit()
+
def load_github():
github = feedparser.parse("http://github.com/sharms.atom")
g.db.cursor().execute('DELETE FROM entries WHERE source = "github"')
View
@@ -31,6 +31,7 @@ <h2>Resources</h2>
<li><a href="http://www.sharms.org/blog">Blog</a></li>
<li><a href="http://www.github.com/sharms">Github</a></li>
<li><a href="http://www.twitter.com/stevenharms">Twitter</a></li>
+ <li><a href="http://www.delicious.com/stevenharms">Delicious</a></li>
</ul>
</div>
</div>

0 comments on commit 9b4b3f3

Please sign in to comment.