aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-29 11:07:02 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-05-29 11:07:02 +0200
commit692f585dd7c5cbccd3aedd27b63950e7f287aeba (patch)
treefd7ee84585a910f53de885d60eec4575055cb0fc
parentUpdated README. (diff)
downloadnewspipe-692f585dd7c5cbccd3aedd27b63950e7f287aeba.tar.gz
newspipe-692f585dd7c5cbccd3aedd27b63950e7f287aeba.tar.bz2
newspipe-692f585dd7c5cbccd3aedd27b63950e7f287aeba.zip
fetch.py can now retrieved articles for all user (when no arguments are given).
-rw-r--r--fetch.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/fetch.py b/fetch.py
index e65fc1b1..38d1ba2f 100644
--- a/fetch.py
+++ b/fetch.py
@@ -9,6 +9,7 @@
import sys
from pyaggr3g470r import crawler
+from pyaggr3g470r.models import User
if __name__ == "__main__":
# Point of entry in execution mode
@@ -16,5 +17,14 @@ if __name__ == "__main__":
feed_id = int(sys.argv[2])
except:
feed_id = None
- feed_getter = crawler.FeedGetter(sys.argv[1])
- feed_getter.retrieve_feed(feed_id)
+
+ users = []
+ try:
+ users = User.query.filter(User.email == sys.argv[1]).all()
+ except:
+ users = User.query.all()
+
+ for user in users:
+ print "Fetching articles for", user.nickname
+ feed_getter = crawler.FeedGetter(user.email)
+ feed_getter.retrieve_feed(feed_id)
bgstack15