summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-08-02 16:59:54 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-08-02 16:59:54 +0200
commitcd8054ebbbfb48b168cb59ce72006aef4586882d (patch)
treea24f1aff063c02a8381b1ef46a73fabac698943c /bin
parent9a7ba2b848209733fb80c4bc2844d750d439b228 (diff)
add basic python updater script
Diffstat (limited to 'bin')
-rw-r--r--bin/updater.py60
1 files changed, 60 insertions, 0 deletions
diff --git a/bin/updater.py b/bin/updater.py
new file mode 100644
index 000000000..3cde30678
--- /dev/null
+++ b/bin/updater.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+
+"""
+
+ownCloud - News
+
+@author Bernhard Posselt
+@copyright 2012 Bernhard Posselt nukeawhale@gmail.com
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+License as published by the Free Software Foundation; either
+version 3 of the License, or any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+
+You should have received a copy of the GNU Affero General Public
+License along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+"""
+
+# This script uses python 3
+from argparse import ArgumentParser
+from urllib import request
+
+def main():
+ parser = ArgumentParser()
+ parser.add_argument('--threads',
+ help='How many feeds should be fetched in paralell, defaults to 10',
+ default=10)
+ parser.add_argument('--interval',
+ help='Minimal update interval between fetching the next round of \
+ updates in minutes, defaults to 30 minutes',
+ default=30)
+ parser.add_argument('--user',
+ help='A username to log into ownCloud', required=True)
+ parser.add_argument('--pass',
+ help='A password to log into ownCloud', required=True)
+ parser.add_argument('url',
+ help='The URL where owncloud is installed')
+ args = parser.parse_args()
+
+ # TODO: main loop with update inteval
+ # TODO: make a request to the cleanup route
+ # TODO: get all feeds and update them in seperate threads
+
+ # TODO: also check for the other URLErrors
+ try:
+ pass
+ except ValueError:
+ print('Please enter a valid URL')
+
+
+if __name__ == '__main__':
+ main()
+
+