aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-12-03 08:35:50 +0100
committercedricbonhomme <devnull@localhost>2010-12-03 08:35:50 +0100
commitb20aa05eaeb04f6d2960e5523dea58a19c21c0e2 (patch)
treef837aee0e1ea135798b0ac287b27911ad418c943 /utils.py
parentUpdated code for new data structure. #6 (diff)
downloadnewspipe-b20aa05eaeb04f6d2960e5523dea58a19c21c0e2.tar.gz
newspipe-b20aa05eaeb04f6d2960e5523dea58a19c21c0e2.tar.bz2
newspipe-b20aa05eaeb04f6d2960e5523dea58a19c21c0e2.zip
Updated code for new data structure. #7
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/utils.py b/utils.py
index 24d92c35..d8d205ba 100755
--- a/utils.py
+++ b/utils.py
@@ -346,18 +346,16 @@ def load_feed():
nb_mail_notifications = 0
nb_favorites = 0
- # articles[feed_id] = (article_id, article_date, article_title,
- # article_link, article_description, article_readed, like)
- # feeds[feed_id] = (nb_article, nb_article_unreaded, feed_image,
- # feed_title, feed_link, feed_site_link, mail)
- #articles, feeds = defaultdict(list), OrderedDict()
+ # Contains the list of Feed object.
feeds = OrderedDict()
+
if list_of_feeds != []:
sha1_hash = hashlib.sha1()
# Case-insensitive sorting
tupleList = [(x[0].lower(), x) for x in list_of_feeds]
tupleList.sort(key=operator.itemgetter(0))
+ # Walk through the list of feeds
for feed in [x[1] for x in tupleList]:
list_of_articles = c.execute(\
"SELECT * FROM articles WHERE feed_link='" + \
@@ -366,6 +364,7 @@ def load_feed():
sha1_hash.update(feed[2].encode('utf-8'))
feed_id = sha1_hash.hexdigest()
+ # Current Feed object
feed_object = articles.Feed()
feed_object.feed_id = feed_id
feed_object.feed_title = feed[0]
@@ -376,14 +375,12 @@ def load_feed():
if list_of_articles != []:
list_of_articles.sort(lambda x,y: compare(y[0], x[0]))
+ # Walk through the list of articles for the current feed.
for article in list_of_articles:
sha1_hash.update(article[2].encode('utf-8'))
article_id = sha1_hash.hexdigest()
- # informations about the current article
- article_list = (article_id, article[0], unescape(article[1]), \
- article[2], unescape(article[3]), \
- article[4], article[6])
+ # Current Article object
article_object = articles.Article()
article_object.article_id = article_id
article_object.article_date = article[0]
bgstack15