|
|
@ -2209,16 +2209,32 @@ def upload():
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#add language actually one value in list
|
|
|
|
|
|
|
|
input_language = meta.languages
|
|
|
|
|
|
|
|
db_language = None
|
|
|
|
|
|
|
|
if input_language != "":
|
|
|
|
|
|
|
|
input_language = isoLanguages.get(name=input_language).part3
|
|
|
|
|
|
|
|
hasLanguage = db.session.query(db.Languages).filter(db.Languages.lang_code == input_language).first()
|
|
|
|
|
|
|
|
if hasLanguage:
|
|
|
|
|
|
|
|
db_language = hasLanguage
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
db_language = db.Languages(input_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, 01, 01), 1,
|
|
|
|
db_book = db.Books(title, "", db_author.sort, datetime.datetime.now(), datetime.datetime(101, 01, 01), 1,
|
|
|
|
datetime.datetime.now(), path, has_cover, db_author, [])
|
|
|
|
datetime.datetime.now(), path, has_cover, db_author, [], db_language)
|
|
|
|
db_book.authors.append(db_author)
|
|
|
|
db_book.authors.append(db_author)
|
|
|
|
|
|
|
|
if db_language is not None:
|
|
|
|
|
|
|
|
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)
|
|
|
|
db_book.data.append(db_data)
|
|
|
|
db_book.data.append(db_data)
|
|
|
|
|
|
|
|
|
|
|
|
db.session.add(db_book)
|
|
|
|
db.session.add(db_book)
|
|
|
|
db.session.commit()
|
|
|
|
db.session.commit()
|
|
|
|
|
|
|
|
if db_language is not None: #display Full name instead of iso639.part3
|
|
|
|
|
|
|
|
db_book.languages[0].language_name = meta.languages
|
|
|
|
author_names = []
|
|
|
|
author_names = []
|
|
|
|
for author in db_book.authors:
|
|
|
|
for author in db_book.authors:
|
|
|
|
author_names.append(author.name)
|
|
|
|
author_names.append(author.name)
|
|
|
|