aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyAggr3g470r.py11
-rw-r--r--tuxdroid.py5
-rw-r--r--utils.py6
3 files changed, 12 insertions, 10 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index a359cdb6..200506bb 100644
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -322,8 +322,7 @@ class Root:
html += """Your feeds (%s):<br />\n""" % len(self.articles.keys())
for rss_feed_id in self.articles.keys():
- html += """<a href="/#%s">%s</a> (<a href="/unread/%s"
- title="Unread article(s)">%s</a> / %s)<br />\n""" % \
+ html += """<a href="/#%s">%s</a> (<a href="/unread/%s" title="Unread article(s)">%s</a> / %s)<br />\n""" % \
(rss_feed_id.encode('utf-8'), \
self.feeds[rss_feed_id][3].encode('utf-8'), \
rss_feed_id, self.feeds[rss_feed_id][1], \
@@ -370,9 +369,11 @@ class Root:
for article in self.articles[rss_feed_id]:
if article[5] == "0":
html += article[1].encode('utf-8') + \
- """ - <a href="/description/%s" rel="noreferrer" target="_blank">%s</a>""" % \
- (article[0].encode('utf-8'), article[2].encode('utf-8')) + \
- "<br />\n"
+ """ - <a href="/description/%s" rel="noreferrer" target="_blank">%s</a>
+ from <i><a href="%s">%s</a></i><br />\n""" % \
+ (article[0].encode('utf-8'), article[2].encode('utf-8'), \
+ self.feeds[rss_feed_id][5].encode('utf-8'), \
+ self.feeds[rss_feed_id][3].encode('utf-8'))
html += """<hr />\n<a href="/mark_as_read/All:">Mark articles as read</a>\n"""
else:
html += """<h1>Unread article(s) of the feed <a href="/all_articles/%s">%s</a></h1>
diff --git a/tuxdroid.py b/tuxdroid.py
index a40b9bcd..c48fadf2 100644
--- a/tuxdroid.py
+++ b/tuxdroid.py
@@ -73,7 +73,8 @@ class Tux(object):
c.close()
except Exception, e:
pass
- self.say_something(str(len(unread_articles)))
+ self.say_something("News to read !")
+ #self.say_something(str(len(unread_articles)))
#for unread_article in unread_articles:
#self.say_something()
@@ -84,4 +85,4 @@ if __name__ == "__main__":
while True:
time.sleep(10)
tux_reader.check_feeds()
- tux_reader.disconnect() \ No newline at end of file
+ tux_reader.disconnect()
diff --git a/utils.py b/utils.py
index 4289a7ee..e2294446 100644
--- a/utils.py
+++ b/utils.py
@@ -26,8 +26,8 @@ def remove_html_tags(data):
def top_words(dic_articles, n=10):
"""
+ Return the n most frequent words in a list.
"""
- N = 10
words = {}
articles_content = ""
for rss_feed_id in dic_articles.keys():
@@ -40,7 +40,7 @@ def top_words(dic_articles, n=10):
for word in words_gen:
words[word] += 1
top_words = sorted(words.iteritems(),
- key=lambda(word, count): (-count, word))[:N]
+ key=lambda(word, count): (-count, word))[:n]
return top_words
def create_histogram(words, file_name="./var/histogram.png"):
@@ -161,4 +161,4 @@ def load_feed():
c.close()
return (articles, feeds)
- return (articles, feeds) \ No newline at end of file
+ return (articles, feeds)
bgstack15