From 6c1461a9a6af51706f4d7a226ea2cb12bb8937b0 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 23 Jul 2013 10:33:43 +0200 Subject: Improved the function which add a new feed URL to the file with the list of monitored links. --- source/utils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/utils.py') diff --git a/source/utils.py b/source/utils.py index d470456d..ddcb2e55 100755 --- a/source/utils.py +++ b/source/utils.py @@ -206,13 +206,16 @@ def add_feed(feed_url): """ Add the URL feed_url in the file feed.lst. """ + feeds = [] if os.path.exists(conf.FEED_LIST): for line in open(conf.FEED_LIST, "r"): + feeds.append(line.replace("\n", "")) if feed_url in line: # if the feed is already in the file return False - with open(conf.FEED_LIST, "a") as f: - f.write(feed_url + "\n") + feeds.append(feed_url) + with open(conf.FEED_LIST, "w") as f: + f.write("\n".join(feeds) + "\n") return True def change_feed_url(old_feed_url, new_feed_url): -- cgit