|
|
@ -2928,7 +2928,8 @@ def upload():
|
|
|
|
|
|
|
|
|
|
|
|
title = meta.title
|
|
|
|
title = meta.title
|
|
|
|
author = meta.author
|
|
|
|
author = meta.author
|
|
|
|
|
|
|
|
series = meta.series
|
|
|
|
|
|
|
|
series_index = meta.series_id
|
|
|
|
title_dir = helper.get_valid_filename(title, False)
|
|
|
|
title_dir = helper.get_valid_filename(title, False)
|
|
|
|
author_dir = helper.get_valid_filename(author, False)
|
|
|
|
author_dir = helper.get_valid_filename(author, False)
|
|
|
|
data_name = title_dir
|
|
|
|
data_name = title_dir
|
|
|
@ -2967,6 +2968,14 @@ def upload():
|
|
|
|
db_author = db.Authors(author, helper.get_sorted_author(author), "")
|
|
|
|
db_author = db.Authors(author, helper.get_sorted_author(author), "")
|
|
|
|
db.session.add(db_author)
|
|
|
|
db.session.add(db_author)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
db_series = None
|
|
|
|
|
|
|
|
is_series = db.session.query(db.Series).filter(db.Series.name == series).first()
|
|
|
|
|
|
|
|
if is_series:
|
|
|
|
|
|
|
|
db_series = is_series
|
|
|
|
|
|
|
|
elif series != '':
|
|
|
|
|
|
|
|
db_series = db.Series(series, "")
|
|
|
|
|
|
|
|
db.session.add(db_series)
|
|
|
|
|
|
|
|
|
|
|
|
# add language actually one value in list
|
|
|
|
# add language actually one value in list
|
|
|
|
input_language = meta.languages
|
|
|
|
input_language = meta.languages
|
|
|
|
db_language = None
|
|
|
|
db_language = None
|
|
|
@ -2980,9 +2989,11 @@ def upload():
|
|
|
|
db.session.add(db_language)
|
|
|
|
db.session.add(db_language)
|
|
|
|
# combine path and normalize path from windows systems
|
|
|
|
# combine path and normalize path from windows systems
|
|
|
|
path = os.path.join(author_dir, title_dir).replace('\\', '/')
|
|
|
|
path = os.path.join(author_dir, title_dir).replace('\\', '/')
|
|
|
|
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 1, 1), 1,
|
|
|
|
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 1, 1),
|
|
|
|
datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
|
|
|
series_index, datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
|
|
|
db_book.authors.append(db_author)
|
|
|
|
db_book.authors.append(db_author)
|
|
|
|
|
|
|
|
if db_series:
|
|
|
|
|
|
|
|
db_book.series.append(db_series)
|
|
|
|
if db_language is not None:
|
|
|
|
if db_language is not None:
|
|
|
|
db_book.languages.append(db_language)
|
|
|
|
db_book.languages.append(db_language)
|
|
|
|
db_data = db.Data(db_book, meta.extension.upper()[1:], file_size, data_name)
|
|
|
|
db_data = db.Data(db_book, meta.extension.upper()[1:], file_size, data_name)
|
|
|
@ -3017,4 +3028,4 @@ def start_gevent():
|
|
|
|
from gevent.wsgi import WSGIServer
|
|
|
|
from gevent.wsgi import WSGIServer
|
|
|
|
global gevent_server
|
|
|
|
global gevent_server
|
|
|
|
gevent_server = WSGIServer(('', ub.config.config_port), app)
|
|
|
|
gevent_server = WSGIServer(('', ub.config.config_port), app)
|
|
|
|
gevent_server.serve_forever()
|
|
|
|
gevent_server.serve_forever()
|