aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-05-09 19:27:03 +0200
committercedricbonhomme <devnull@localhost>2010-05-09 19:27:03 +0200
commitf7cd4ab03a10bc0089840144e4fec98ec7981a10 (patch)
tree8c9c5c48609d4af95a9037b383ddded8c2df28bc /pyAggr3g470r.py
parentRelease 1.3. Export function (HTML, raw text). (diff)
downloadnewspipe-f7cd4ab03a10bc0089840144e4fec98ec7981a10.tar.gz
newspipe-f7cd4ab03a10bc0089840144e4fec98ec7981a10.tar.bz2
newspipe-f7cd4ab03a10bc0089840144e4fec98ec7981a10.zip
Improvements of HTML and text export.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 0daf89ca..726c2a1a 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -653,7 +653,7 @@ class Root:
html += """<p>Notifications are sent to: <a href="mail:%s">%s</a></p>""" % \
(utils.mail_to, utils.mail_to)
html += "\n<hr />\n" + htmlfooter
- return html
+ return html"<h1>" + article[2].encode('utf-8') + "</h1><br /><br />"
list_notification.exposed = True
@@ -749,25 +749,30 @@ class Root:
def export(self, export_method):
"""
- Export articles stored in the SQLite database in a text files.
+ Export articles stored in the SQLite database in text files.
"""
for rss_feed_id in self.feeds.keys():
folder = utils.path + "var/export/" + self.feeds[rss_feed_id][3]
+ folder = folder.replace(' ', '_')
try:
os.makedirs(folder)
except OSError:
- return self.error_page(folder+" already exists.")
+ return self.error_page(utils.path + "var/export/"+" already exists.\nYou should delete this folder.")
for article in self.articles[rss_feed_id]:
try:
if export_method == "export_HTML":
- f = open(folder + "/" + article[2]+ ".html", "w")
+ name = folder + "/" + article[1]+ ".html"
+ f = open(name.replace(' ', '_'), "w")
content = htmlheader
+ content += "<h1>" + article[2].encode('utf-8') + "</h1><br />"
content += article[4].encode('utf-8')
content += "<hr />\n"
content += htmlfooter
elif export_method == "export_TXT":
- f = open(folder + "/" + article[2], "w")
- content = utils.remove_html_tags(article[4].encode('utf-8'))
+ name = folder + "/" + article[1] + ".txt"
+ f = open(name.replace(' ', '_'), "w")
+ content = "Title: " + article[2].encode('utf-8') + "\n\n\n"
+ content += utils.remove_html_tags(article[4].encode('utf-8'))
f.write(content)
except IOError:
pass
bgstack15