aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-11-04 22:24:05 +0100
committercedricbonhomme <devnull@localhost>2010-11-04 22:24:05 +0100
commitf6477cfceeb7fa9400ba76a0c9f22c7703c2d7a5 (patch)
treeeeff9a799e50028fa7f8021b14fbaf034878d4ee /utils.py
parentMajor improvement of the performance (concerning the management page). (diff)
downloadnewspipe-f6477cfceeb7fa9400ba76a0c9f22c7703c2d7a5.tar.gz
newspipe-f6477cfceeb7fa9400ba76a0c9f22c7703c2d7a5.tar.bz2
newspipe-f6477cfceeb7fa9400ba76a0c9f22c7703c2d7a5.zip
Improvement of the performance (concerning the load of articles from data base in memory).
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/utils.py b/utils.py
index c62e1237..4da2dd99 100755
--- a/utils.py
+++ b/utils.py
@@ -363,6 +363,11 @@ def load_feed():
tupleList = [(x[0].lower(), x) for x in list_of_feeds]
tupleList.sort(key=operator.itemgetter(0))
+ nb_articles = 0
+ nb_unread_articles = 0
+ nb_mail_notifications = 0
+ nb_favorites = 0
+
for feed in [x[1] for x in tupleList]:
list_of_articles = c.execute(\
"SELECT * FROM articles WHERE feed_link='" + \
@@ -392,6 +397,10 @@ def load_feed():
article[2], unescape(article[3]), \
article[4], language, article[6]]
+
+ nb_favorites = nb_favorites + int(article[6])
+
+
if feed_id not in articles:
try:
articles[feed_id] = blist([article_list])
@@ -407,8 +416,12 @@ def load_feed():
feed[3], feed[0], feed[2], feed[1] , feed[4]\
)
+ nb_articles += feeds[feed_id][0]
+ nb_unread_articles += feeds[feed_id][1]
+ nb_mail_notifications += int(feeds[feed_id][6])
+
c.close()
LOCKER.release()
- return (articles, feeds)
+ return (articles, feeds, nb_articles, nb_unread_articles, nb_favorites, nb_mail_notifications)
LOCKER.release()
- return (articles, feeds)
+ return (articles, feeds, nb_articles, nb_unread_articles, nb_favorites, nb_mail_notifications)
bgstack15