aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-07-05 11:15:54 +0200
committercedricbonhomme <devnull@localhost>2010-07-05 11:15:54 +0200
commitdc902942803d9f966639c9665cfefb0a9b7c65db (patch)
treef6e1628e291307ccc213a1c54228dbd058ebd0c8
parentImprovements, exception management. (diff)
downloadnewspipe-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.
-rwxr-xr-xpyAggr3g470r.py8
-rwxr-xr-xutils.py11
2 files changed, 11 insertions, 8 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 66379d4b..78ce5390 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -2,8 +2,8 @@
#-*- coding: utf-8 -*-
__author__ = "Cedric Bonhomme"
-__version__ = "$Revision: 1.4 $"
-__date__ = "$Date: 2010/06/10 $"
+__version__ = "$Revision: 1.5 $"
+__date__ = "$Date: 2010/07/05 $"
__copyright__ = "Copyright (c) 2010 Cedric Bonhomme"
__license__ = "GPLv3"
@@ -90,7 +90,7 @@ class Root:
html += """<a href="/unread/All">Unread article(s): %s</a>\n""" % \
(sum([feed[1] for feed in self.feeds.values()]),)
- for rss_feed_id in self.articles.keys():
+ for rss_feed_id in self.feeds.keys():
html += """<h2><a name="%s"><a href="%s" rel="noreferrer"
target="_blank">%s</a></a>
<a href="%s" rel="noreferrer"
@@ -163,7 +163,7 @@ class Root:
Create the list of feeds.
"""
html = """Your feeds (%s):<br />\n""" % len(self.articles.keys())
- for rss_feed_id in self.articles.keys():
+ for rss_feed_id in self.feeds.keys():
if self.feeds[rss_feed_id][1] != 0:
# not readed articles are in bold
not_read_begin = "<b>"
diff --git a/utils.py b/utils.py
index b3c464bb..1c699b34 100755
--- a/utils.py
+++ b/utils.py
@@ -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)
bgstack15