aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-07-23 10:33:43 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-07-23 10:33:43 +0200
commit6c1461a9a6af51706f4d7a226ea2cb12bb8937b0 (patch)
tree40100eed17e47102e34f904bbc69e7bd00a2e0c5
parentcall rmpid() to delete the file which contains the pid pf pyAggr3g470r. (diff)
downloadnewspipe-6c1461a9a6af51706f4d7a226ea2cb12bb8937b0.tar.gz
newspipe-6c1461a9a6af51706f4d7a226ea2cb12bb8937b0.tar.bz2
newspipe-6c1461a9a6af51706f4d7a226ea2cb12bb8937b0.zip
Improved the function which add a new feed URL to the file with the list of monitored links.
-rwxr-xr-xsource/utils.py7
1 files changed, 5 insertions, 2 deletions
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):
bgstack15