|
|
@ -287,7 +287,7 @@ def shortentitle_filter(s):
|
|
|
|
def mimetype_filter(val):
|
|
|
|
def mimetype_filter(val):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
s = mimetypes.types_map['.' + val]
|
|
|
|
s = mimetypes.types_map['.' + val]
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
s = 'application/octet-stream'
|
|
|
|
s = 'application/octet-stream'
|
|
|
|
return s
|
|
|
|
return s
|
|
|
|
|
|
|
|
|
|
|
@ -762,7 +762,7 @@ def get_updater_status():
|
|
|
|
elif request.method == "GET":
|
|
|
|
elif request.method == "GET":
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
status['status'] = 7
|
|
|
|
status['status'] = 7
|
|
|
|
return json.dumps(status)
|
|
|
|
return json.dumps(status)
|
|
|
|
|
|
|
|
|
|
|
@ -777,7 +777,7 @@ def get_languages_json():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
entries = [s for s in languages if query in s.name.lower()]
|
|
|
|
entries = [s for s in languages if query in s.name.lower()]
|
|
|
|
json_dumps = json.dumps([dict(name=r.name) for r in entries])
|
|
|
|
json_dumps = json.dumps([dict(name=r.name) for r in entries])
|
|
|
@ -937,13 +937,13 @@ def language_overview():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
langfound = 1
|
|
|
|
langfound = 1
|
|
|
|
cur_l = LC.parse(current_user.filter_language())
|
|
|
|
cur_l = LC.parse(current_user.filter_language())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
langfound = 0
|
|
|
|
langfound = 0
|
|
|
|
languages = db.session.query(db.Languages).filter(
|
|
|
|
languages = db.session.query(db.Languages).filter(
|
|
|
|
db.Languages.lang_code == current_user.filter_language()).all()
|
|
|
|
db.Languages.lang_code == current_user.filter_language()).all()
|
|
|
@ -967,7 +967,7 @@ def language(name, page):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(name)
|
|
|
|
cur_l = LC.parse(name)
|
|
|
|
name = cur_l.get_language_name(get_locale())
|
|
|
|
name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
name = _(isoLanguages.get(part3=name).name)
|
|
|
|
name = _(isoLanguages.get(part3=name).name)
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
title=_(u"Language: %(name)s", name=name))
|
|
|
|
title=_(u"Language: %(name)s", name=name))
|
|
|
@ -1011,7 +1011,7 @@ def show_book(id):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
entries.languages[index].language_name = LC.parse(entries.languages[index].lang_code).get_language_name(
|
|
|
|
entries.languages[index].language_name = LC.parse(entries.languages[index].lang_code).get_language_name(
|
|
|
|
get_locale())
|
|
|
|
get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
entries.languages[index].language_name = _(
|
|
|
|
entries.languages[index].language_name = _(
|
|
|
|
isoLanguages.get(part3=entries.languages[index].lang_code).name)
|
|
|
|
isoLanguages.get(part3=entries.languages[index].lang_code).name)
|
|
|
|
cc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
|
|
|
|
cc = db.session.query(db.Custom_Columns).filter(db.Custom_Columns.datatype.notin_(db.cc_exceptions)).all()
|
|
|
@ -1155,7 +1155,7 @@ def advanced_search():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
searchterm.extend(language.name for language in language_names)
|
|
|
|
searchterm.extend(language.name for language in language_names)
|
|
|
|
searchterm = " + ".join(filter(None, searchterm))
|
|
|
|
searchterm = " + ".join(filter(None, searchterm))
|
|
|
@ -1187,7 +1187,7 @@ def advanced_search():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
languages = None
|
|
|
|
languages = None
|
|
|
@ -1289,7 +1289,7 @@ def get_download_link(book_id, format):
|
|
|
|
send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + format))
|
|
|
|
send_from_directory(os.path.join(config.config_calibre_dir, book.path), data.name + "." + format))
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
response.headers["Content-Type"] = mimetypes.types_map['.' + format]
|
|
|
|
response.headers["Content-Type"] = mimetypes.types_map['.' + format]
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
pass
|
|
|
|
pass
|
|
|
|
response.headers["Content-Disposition"] = "attachment; filename=\"%s.%s\"" % (quote(file_name.encode('utf-8')), format)
|
|
|
|
response.headers["Content-Disposition"] = "attachment; filename=\"%s.%s\"" % (quote(file_name.encode('utf-8')), format)
|
|
|
|
return response
|
|
|
|
return response
|
|
|
@ -1321,7 +1321,7 @@ def register():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
ub.session.add(content)
|
|
|
|
ub.session.add(content)
|
|
|
|
ub.session.commit()
|
|
|
|
ub.session.commit()
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
ub.session.rollback()
|
|
|
|
ub.session.rollback()
|
|
|
|
flash(_(u"An unknown error occured. Please try again later."), category="error")
|
|
|
|
flash(_(u"An unknown error occured. Please try again later."), category="error")
|
|
|
|
return render_title_template('register.html', title=_(u"register"))
|
|
|
|
return render_title_template('register.html', title=_(u"register"))
|
|
|
@ -1446,7 +1446,7 @@ def create_shelf():
|
|
|
|
ub.session.add(shelf)
|
|
|
|
ub.session.add(shelf)
|
|
|
|
ub.session.commit()
|
|
|
|
ub.session.commit()
|
|
|
|
flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success")
|
|
|
|
flash(_(u"Shelf %(title)s created", title=to_save["title"]), category="success")
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
flash(_(u"There was an error"), category="error")
|
|
|
|
flash(_(u"There was an error"), category="error")
|
|
|
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"))
|
|
|
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"create a shelf"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1474,7 +1474,7 @@ def edit_shelf(shelf_id):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
ub.session.commit()
|
|
|
|
ub.session.commit()
|
|
|
|
flash(_(u"Shelf %(title)s changed", title=to_save["title"]), category="success")
|
|
|
|
flash(_(u"Shelf %(title)s changed", title=to_save["title"]), category="success")
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
flash(_(u"There was an error"), category="error")
|
|
|
|
flash(_(u"There was an error"), category="error")
|
|
|
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"))
|
|
|
|
return render_title_template('shelf_edit.html', shelf=shelf, title=_(u"Edit a shelf"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1562,7 +1562,7 @@ def profile():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
translations = babel.list_translations() + [LC('en')]
|
|
|
|
translations = babel.list_translations() + [LC('en')]
|
|
|
|
for book in content.downloads:
|
|
|
|
for book in content.downloads:
|
|
|
@ -1738,7 +1738,7 @@ def new_user():
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
translations = [LC('en')] + babel.list_translations()
|
|
|
|
translations = [LC('en')] + babel.list_translations()
|
|
|
|
if request.method == "POST":
|
|
|
|
if request.method == "POST":
|
|
|
@ -1836,7 +1836,7 @@ def edit_user(user_id):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
cur_l = LC.parse(lang.lang_code)
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
lang.name = cur_l.get_language_name(get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name)
|
|
|
|
translations = babel.list_translations() + [LC('en')]
|
|
|
|
translations = babel.list_translations() + [LC('en')]
|
|
|
|
for book in content.downloads:
|
|
|
|
for book in content.downloads:
|
|
|
@ -1958,7 +1958,7 @@ def edit_book(book_id):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
book.languages[index].language_name = LC.parse(book.languages[index].lang_code).get_language_name(
|
|
|
|
book.languages[index].language_name = LC.parse(book.languages[index].lang_code).get_language_name(
|
|
|
|
get_locale())
|
|
|
|
get_locale())
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
book.languages[index].language_name = _(isoLanguages.get(part3=book.languages[index].lang_code).name)
|
|
|
|
book.languages[index].language_name = _(isoLanguages.get(part3=book.languages[index].lang_code).name)
|
|
|
|
for author in book.authors:
|
|
|
|
for author in book.authors:
|
|
|
|
author_names.append(author.name)
|
|
|
|
author_names.append(author.name)
|
|
|
@ -2008,7 +2008,7 @@ def edit_book(book_id):
|
|
|
|
for lang in languages:
|
|
|
|
for lang in languages:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
lang.name = LC.parse(lang.lang_code).get_language_name(get_locale()).lower()
|
|
|
|
lang.name = LC.parse(lang.lang_code).get_language_name(get_locale()).lower()
|
|
|
|
except:
|
|
|
|
except Exception as e:
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name).lower()
|
|
|
|
lang.name = _(isoLanguages.get(part3=lang.lang_code).name).lower()
|
|
|
|
for inp_lang in input_languages:
|
|
|
|
for inp_lang in input_languages:
|
|
|
|
if inp_lang == lang.name:
|
|
|
|
if inp_lang == lang.name:
|
|
|
|