diff options
author | cedricbonhomme <devnull@localhost> | 2010-07-05 11:15:54 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2010-07-05 11:15:54 +0200 |
commit | dc902942803d9f966639c9665cfefb0a9b7c65db (patch) | |
tree | f6e1628e291307ccc213a1c54228dbd058ebd0c8 /utils.py | |
parent | Improvements, exception management. (diff) | |
download | newspipe-dc902942803d9f966639c9665cfefb0a9b7c65db.tar.gz newspipe-dc902942803d9f966639c9665cfefb0a9b7c65db.tar.bz2 newspipe-dc902942803d9f966639c9665cfefb0a9b7c65db.zip |
Now pyAggr3g470r only works with Python 2.7. OrderedDict are used in order to sort the feeds alphabetically in a simple way.
Diffstat (limited to 'utils.py')
-rwxr-xr-x | utils.py | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -4,8 +4,8 @@ from __future__ import with_statement __author__ = "Cedric Bonhomme" -__version__ = "$Revision: 0.7 $" -__date__ = "$Date: 2010/06/10 $" +__version__ = "$Revision: 0.8 $" +__date__ = "$Date: 2010/07/05 $" __copyright__ = "Copyright (c) 2010 Cedric Bonhomme" __license__ = "GPLv3" @@ -31,6 +31,7 @@ from BeautifulSoup import BeautifulSoup from datetime import datetime from string import punctuation from collections import defaultdict +from collections import OrderedDict from StringIO import StringIO @@ -279,10 +280,11 @@ def load_feed(): # article_language, like) # feeds[feed_id] = (nb_article, nb_article_unreaded, feed_image, # feed_title, feed_link, feed_site_link, mail) - articles, feeds = {}, {} + articles, feeds = {}, OrderedDict() if list_of_feeds != []: sha1_hash = hashlib.sha1() - for feed in list_of_feeds: + print sorted(list_of_feeds) + for feed in sorted(list_of_feeds): list_of_articles = c.execute(\ "SELECT * FROM articles WHERE feed_link='" + \ feed[2] + "'").fetchall() @@ -322,6 +324,7 @@ def load_feed(): if article[5]=="0"]), \ feed[3], feed[0], feed[2], feed[1] , feed[4]\ ) + c.close() LOCKER.release() return (articles, feeds) |