diff --git a/webserver.py b/webserver.py index 910e9d5..79d9bda 100644 --- a/webserver.py +++ b/webserver.py @@ -11,7 +11,6 @@ import html import argparse import coloredlogs import glob -import csv @@ -168,7 +167,6 @@ class AnimationHandler(tornado.web.RequestHandler): } with open(path, 'r') as fp: events = json.loads('['+fp.read()+']') - # events = csv.reader(fp,delimiter=';') for i, event in enumerate(events): if i == 0: # metadata on first line @@ -222,13 +220,18 @@ class AnnotationsHandler(tornado.web.RequestHandler): self.json_args = json.loads(self.request.body) else: self.json_args = None + + def get_filenames(self): + return [name[:-16] for name in os.listdir(self.config.storage) if name.endswith('json_appendable')] def get(self, filename): self.set_header("Content-Type", "application/json") - filenames = sorted([name[:-4] for name in os.listdir(self.config.storage) if name not in ['.gitignore']]) + filenames = self.get_filenames() + + print(filenames, filename) if filename not in filenames: - raise Exception('Invalid filename') + raise tornado.web.HTTPError(404) meta_file = os.path.join(self.metadir, filename +'.json') @@ -242,10 +245,11 @@ class AnnotationsHandler(tornado.web.RequestHandler): def post(self, filename): # filename = self.get_argument("file", None) - filenames = sorted([name[:-4] for name in os.listdir(self.config.storage) if name not in ['.gitignore']]) + filenames = self.get_filenames() + print(filenames, filename) if filename not in filenames: - raise Exception('Invalid filename') + raise tornado.web.HTTPError(404) if not os.path.exists(self.metadir): os.mkdir(self.metadir) diff --git a/www/annotate.html b/www/annotate.html index d81f2c1..46aa4c3 100644 --- a/www/annotate.html +++ b/www/annotate.html @@ -207,6 +207,26 @@ .noUi-horizontal .noUi-touch-area { cursor: ew-resize; } + + .audioconfig{ + z-index: 9; + background:black; + color: white; + position: relative; + width: 100px; /* as wide as audio controls only */ + overflow: hidden; + white-space: nowrap; + } + .audioconfig:hover{ + width: auto; + } + .audioconfig select, .audioconfig input{ + margin:10px; + } + audio{ + vertical-align: middle; + width: 100px; /* hides seek head */ + } @@ -220,8 +240,9 @@