summaryrefslogtreecommitdiff
path: root/dumps/dump.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2014-10-31 21:45:51 +0100
committeremkael <emkael@tlen.pl>2014-10-31 21:45:51 +0100
commitb13813f96822ed7de314b6dd417831de8a641134 (patch)
tree0dc65154fd9531a31732e422619bb5b7aaebe775 /dumps/dump.py
parentae189fadac1f56b2c10f2a5d11bad99980a8fd46 (diff)
* revised and reorganized dump scripts
Diffstat (limited to 'dumps/dump.py')
-rwxr-xr-xdumps/dump.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/dumps/dump.py b/dumps/dump.py
new file mode 100755
index 0000000..b36e4a1
--- /dev/null
+++ b/dumps/dump.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+from sys import argv
+from compile import compile
+from table2csv import convert
+
+if __name__ == "__main__":
+ if len(argv) > 1:
+ if argv[1] == 'compile':
+ compile(argv[2:])
+ elif len(argv) > 2:
+ if argv[1] == 'fetch':
+ argv.remove('fetch')
+ fetch = __import__('_sites.' + argv[1], globals(), locals(), ['fetch'])
+ for url in argv[2:]:
+ title, tables = fetch.fetch(url)
+ i = 1
+ for table in tables:
+ convert(table, title + '-' + str(i), argv[1])
+ i += 1