summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xrater.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/rater.py b/rater.py
index 8fb3233..1ebc422 100755
--- a/rater.py
+++ b/rater.py
@@ -11,25 +11,8 @@ import json
11# import urllib3.contrib.pyopenssl 11# import urllib3.contrib.pyopenssl
12# urllib3.contrib.pyopenssl.inject_into_urllib3() 12# urllib3.contrib.pyopenssl.inject_into_urllib3()
13 13
14parser = ArgumentParser(description="C3 rating helper") 14db = SQLAlchemy()
15parser.add_argument("-i", action="store_true", dest="pretalx_import", default=False, help="import events from pretalx")
16parser.add_argument("-c", "--config", help="Config file location", default="./config.json")
17args = parser.parse_args()
18
19with open(args.config, mode="r", encoding="utf-8") as json_file:
20 config = json.load(json_file)
21
22app = Flask(__name__) 15app = Flask(__name__)
23app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + config['pretalx-conference'] + '-' + config['track'] + '.db'
24app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
25app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.'
26app.jinja_env.trim_blocks = True
27app.jinja_env.lstrip_blocks = True
28
29db = SQLAlchemy(app)
30
31config['pretalx-conf-url'] = config['pretalx-url'] + 'orga/event/' + config['pretalx-conference']
32config['pretalx-api-url'] = config['pretalx-url'] + 'api/events/' + config['pretalx-conference'] + '/submissions?track_id' + str(config['track-id'])
33 16
34class Event(db.Model): 17class Event(db.Model):
35 """An event as dumped from pretalx""" 18 """An event as dumped from pretalx"""
@@ -157,6 +140,25 @@ def fetch_talks():
157 140
158 141
159if __name__ == "__main__": 142if __name__ == "__main__":
143
144 parser = ArgumentParser(description="C3 rating helper")
145 parser.add_argument("-i", action="store_true", dest="pretalx_import", default=False, help="import events from pretalx")
146 parser.add_argument("-c", "--config", help="Config file location", default="./config.json")
147 args = parser.parse_args()
148
149 with open(args.config, mode="r", encoding="utf-8") as json_file:
150 config = json.load(json_file)
151 config['pretalx-conf-url'] = config['pretalx-url'] + 'orga/event/' + config['pretalx-conference']
152 config['pretalx-api-url'] = config['pretalx-url'] + 'api/events/' + config['pretalx-conference'] + '/submissions?track_id' + str(config['track-id'])
153
154 app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + config['pretalx-conference'] + '-' + config['track'] + '.db'
155 app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
156 app.config['SECRET_KEY'] = 'Silence is golden. Gerd Eist.'
157 app.jinja_env.trim_blocks = True
158 app.jinja_env.lstrip_blocks = True
159
160 db.init_app(app)
161
160 with app.app_context(): 162 with app.app_context():
161 db.create_all() 163 db.create_all()
162 if args.pretalx_import: 164 if args.pretalx_import: