diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-26 22:29:14 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2012-12-26 22:29:14 +0100 |
commit | 3b15af6d55e2c29d38dd08c71dbf89f11f788b90 (patch) | |
tree | eb4fa57f5f3b240278cb8e92d4562e4e74796358 /source | |
parent | Minor Update to documentation. (diff) | |
download | newspipe-3b15af6d55e2c29d38dd08c71dbf89f11f788b90.tar.gz newspipe-3b15af6d55e2c29d38dd08c71dbf89f11f788b90.tar.bz2 newspipe-3b15af6d55e2c29d38dd08c71dbf89f11f788b90.zip |
Simplification of the history code.
Diffstat (limited to 'source')
-rwxr-xr-x | source/pyAggr3g470r.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 3ab5e0ae..acf64137 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -441,15 +441,15 @@ class pyAggr3g470r(object): for article in self.mongo.get_articles(feed["feed_id"]): if query == "all": - timeline[str(article["article_date"]).split(' ')[0].split('-')[0]] += 1 + timeline[article["article_date"].strftime('%Y')] += 1 elif query[:4] == "year": - if str(article["article_date"]).split(' ')[0].split('-')[0] == the_year: - timeline[str(article["article_date"]).split(' ')[0].split('-')[1]] += 1 + if article["article_date"].strftime('%Y') == the_year: + timeline[article["article_date"].strftime('%m')] += 1 if "month" in query: - if str(article["article_date"]).split(' ')[0].split('-')[1] == the_month: + if article["article_date"].strftime('%m') == the_month: if article["article_readed"] == False: # not readed articles are in bold not_read_begin, not_read_end = "<b>", "</b>" @@ -488,7 +488,7 @@ class pyAggr3g470r(object): query_string = "year:" + the_year + "-month" if "month" not in query: html += '<div style="width: 35%; overflow:hidden; text-align: justify">' + \ - utils.tag_cloud([(elem, timeline[elem]) for elem in list(timeline.keys())], query_string) + '</div>' + utils.tag_cloud([(elem, timeline[elem]) for elem in timeline.keys()], query_string) + '</div>' html += '<br /><br /><h1>Search with a month+year picker</h1>\n' html += '<form>\n\t<input name="m" type="month">\n\t<input type="submit" value="Go">\n</form>' html += '<hr />' |