This commit is contained in:
j 2016-01-13 23:18:32 +05:30
parent 3ba16900e6
commit b33d066322
4 changed files with 7 additions and 2 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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':

View file

@ -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 = [];