diff --git a/oml/item/handlers.py b/oml/item/handlers.py index 8bf1544..141c2a2 100644 --- a/oml/item/handlers.py +++ b/oml/item/handlers.py @@ -180,6 +180,8 @@ class UploadHandler(tornado.web.RequestHandler): while os.path.exists(import_name): n += 1 name, extension = filename.rsplit('.', 1) + if extension == 'kepub': + extension = 'epub' import_name = os.path.join(prefix_imported, '%s [%d].%s' % (name, n, extension)) with open(import_name, 'wb') as fd: fd.write(upload.body) diff --git a/oml/item/scan.py b/oml/item/scan.py index 7be7207..bf3ddea 100644 --- a/oml/item/scan.py +++ b/oml/item/scan.py @@ -77,6 +77,8 @@ def run_scan(): continue f = os.path.join(root, f) ext = f.split('.')[-1] + if ext == 'kepub': + ext = 'epub' if ext in extensions: books.append(f) diff --git a/oml/media/__init__.py b/oml/media/__init__.py index a6a2608..cbfe8cd 100644 --- a/oml/media/__init__.py +++ b/oml/media/__init__.py @@ -32,8 +32,9 @@ def metadata(f, from_=None): if ext == 'cbr': info = cbr.info(f) - elif ext == 'epub': + elif ext in ('epub', 'kepub'): info = epub.info(f) + data['extension'] = 'epub' elif ext == 'pdf': info = pdf.info(f) elif ext == 'txt': diff --git a/static/js/utils.js b/static/js/utils.js index a02a280..5a7a24f 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1011,7 +1011,7 @@ oml.updateDebugMenu = function() { oml.user.ui.showDebugMenu ? menu.show() : menu.hide(); }; -oml.supportedExtensions = ['pdf', 'epub', 'cbr', 'cbz']; +oml.supportedExtensions = ['pdf', 'epub', 'kepub', 'cbr', 'cbz']; oml.upload = function(fileslist, callback) { var files = [], ids = [];