aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-02-05 13:10:45 +0100
committercedricbonhomme <devnull@localhost>2010-02-05 13:10:45 +0100
commit6c559d487f96a85194e432248a4055945157ef82 (patch)
tree280f02bb7cab24786e6d6f226f72be680e50e26d
parentRelease 0.5. Added : a link _Fetch all feeds_ manually (when you want, withou... (diff)
downloadnewspipe-6c559d487f96a85194e432248a4055945157ef82.tar.gz
newspipe-6c559d487f96a85194e432248a4055945157ef82.tar.bz2
newspipe-6c559d487f96a85194e432248a4055945157ef82.zip
Unread articles are now in bold (new field in the SQLite database). New tabs for articles's description are opened with the _rel=noreferrer_ option in order to separates processes (useful with Chromium).
-rw-r--r--feedgetter.py8
-rw-r--r--pyAggr3g470r.py38
-rw-r--r--var/feed.lst3
3 files changed, 41 insertions, 8 deletions
diff --git a/feedgetter.py b/feedgetter.py
index a16585d8..b65a25e9 100644
--- a/feedgetter.py
+++ b/feedgetter.py
@@ -44,7 +44,8 @@ class FeedGetter(object):
self.c.execute('''create table if not exists rss_feed
(article_date text, article_title text, \
article_link text PRIMARY KEY, article_description text, \
- feed_title text, feed_site_link text)''')
+ feed_title text, feed_site_link text, \
+ article_readed text)''')
self.conn.commit()
self.c.close()
@@ -110,13 +111,14 @@ class FeedGetter(object):
article_id = sha256_hash.hexdigest()
try:
- self.c.execute('insert into rss_feed values (?,?,?,?,?,?)', (\
+ self.c.execute('insert into rss_feed values (?,?,?,?,?,?,?)', (\
datetime(*article.updated_parsed[:6]), \
article.title.encode('utf-8'), \
article.link.encode('utf-8'), \
description, \
a_feed.feed.title.encode('utf-8'), \
- a_feed.feed.link.encode('utf-8')))
+ a_feed.feed.link.encode('utf-8'), \
+ "0"))
except sqlite3.IntegrityError:
pass
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index fe2ad47b..d12fc942 100644
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -69,10 +69,20 @@ class Root:
# The main page display only 10 articles by feeds.
for article in self.dic[rss_feed_id][:10]:
+
+ if article[7] == "0":
+ # not readed articles are in bold
+ not_read_begin = "<b>"
+ not_read_end = "</b>"
+ else:
+ not_read_begin = ""
+ not_read_end = ""
+
html += article[1].encode('utf-8') + " - " + \
- '<a href="' + article[3].encode('utf-8') + \
- '">' + article[2].encode('utf-8') + "</a>" + \
- """ - [<a href="/description/%s">description</a>]""" % (article[0].encode('utf-8'),) + \
+ not_read_begin + \
+ """ - <a href="/description/%s" rel="noreferrer" target="_blank">%s</a>""" % \
+ (article[0].encode('utf-8'), article[2].encode('utf-8')) + \
+ not_read_end + \
"<br />\n"
html += "<br />\n"
@@ -105,6 +115,9 @@ class Root:
for rss_feed_id in self.dic.keys():
for article in self.dic[rss_feed_id]:
if article_id == article[0]:
+
+ self.mark_as_read(article[3])
+
html += """<h1><i>%s</i> from <a href="/all_articles/%s">%s</a></h1><br />""" % \
(article[2].encode('utf-8'), rss_feed_id, article[5].encode('utf-8'))
description = article[4].encode('utf-8')
@@ -151,7 +164,7 @@ class Root:
pass
# The key of dic is the id of the feed:
- # dic[feed_if] = (article_id, article_date, article_title, article_link, article_description, feed_title, feed_link)
+ # dic[feed_id] = (article_id, article_date, article_title, article_link, article_description, feed_title, feed_link)
dic = {}
if list_of_articles is not None:
for article in list_of_articles:
@@ -161,7 +174,8 @@ class Root:
sha256_hash.update(article[2].encode('utf-8'))
article_id = sha256_hash.hexdigest()
- article_tuple = (article_id, article[0], article[1], article[2], article[3], article[4], article[5])
+ article_tuple = (article_id, article[0], article[1], \
+ article[2], article[3], article[4], article[5], article[6])
if feed_id not in dic:
dic[feed_id] = [article_tuple]
@@ -175,6 +189,20 @@ class Root:
return dic
return dic
+ def mark_as_read(self, article_link):
+ """
+ Mark an article as read by setting the value of the field
+ 'article_readed' of the SQLite database to 1.
+ """
+ try:
+ conn = sqlite3.connect("./var/feed.db", isolation_level = None)
+ c = conn.cursor()
+ c.execute("UPDATE rss_feed SET article_readed=1 WHERE article_link='" + article_link + "'")
+ conn.commit()
+ c.close()
+ except Exception, e:
+ pass
+
index.exposed = True
m.exposed = True
f.exposed = True
diff --git a/var/feed.lst b/var/feed.lst
index fb8efcd6..02fc20c5 100644
--- a/var/feed.lst
+++ b/var/feed.lst
@@ -18,3 +18,6 @@ http://www.le-tigre.net/spip.php?page=backend
http://formats-ouverts.org/rss.php
http://lwn.net/headlines/newrss
http://kernelnewbies.org/RecentChanges?action=rss_rc&ddiffs=1&unique=1
+http://www.kroah.com/log/index.rss
+http://www.lessentiel.lu/rss/news.tmpl
+http://www.jeffersonswheel.org/?feed=rss2
bgstack15