import kepub as epub, http://wiki.mobileread.com/wiki/Kepub
This commit is contained in:
parent
3ba16900e6
commit
b33d066322
4 changed files with 7 additions and 2 deletions
|
@ -180,6 +180,8 @@ class UploadHandler(tornado.web.RequestHandler):
|
||||||
while os.path.exists(import_name):
|
while os.path.exists(import_name):
|
||||||
n += 1
|
n += 1
|
||||||
name, extension = filename.rsplit('.', 1)
|
name, extension = filename.rsplit('.', 1)
|
||||||
|
if extension == 'kepub':
|
||||||
|
extension = 'epub'
|
||||||
import_name = os.path.join(prefix_imported, '%s [%d].%s' % (name, n, extension))
|
import_name = os.path.join(prefix_imported, '%s [%d].%s' % (name, n, extension))
|
||||||
with open(import_name, 'wb') as fd:
|
with open(import_name, 'wb') as fd:
|
||||||
fd.write(upload.body)
|
fd.write(upload.body)
|
||||||
|
|
|
@ -77,6 +77,8 @@ def run_scan():
|
||||||
continue
|
continue
|
||||||
f = os.path.join(root, f)
|
f = os.path.join(root, f)
|
||||||
ext = f.split('.')[-1]
|
ext = f.split('.')[-1]
|
||||||
|
if ext == 'kepub':
|
||||||
|
ext = 'epub'
|
||||||
if ext in extensions:
|
if ext in extensions:
|
||||||
books.append(f)
|
books.append(f)
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,9 @@ def metadata(f, from_=None):
|
||||||
|
|
||||||
if ext == 'cbr':
|
if ext == 'cbr':
|
||||||
info = cbr.info(f)
|
info = cbr.info(f)
|
||||||
elif ext == 'epub':
|
elif ext in ('epub', 'kepub'):
|
||||||
info = epub.info(f)
|
info = epub.info(f)
|
||||||
|
data['extension'] = 'epub'
|
||||||
elif ext == 'pdf':
|
elif ext == 'pdf':
|
||||||
info = pdf.info(f)
|
info = pdf.info(f)
|
||||||
elif ext == 'txt':
|
elif ext == 'txt':
|
||||||
|
|
|
@ -1011,7 +1011,7 @@ oml.updateDebugMenu = function() {
|
||||||
oml.user.ui.showDebugMenu ? menu.show() : menu.hide();
|
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) {
|
oml.upload = function(fileslist, callback) {
|
||||||
var files = [], ids = [];
|
var files = [], ids = [];
|
||||||
|
|
Loading…
Reference in a new issue