|
|
|
@ -1046,27 +1046,35 @@ def index(page):
|
|
|
|
|
@app.route('/books/newest/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def newest_books(page):
|
|
|
|
|
if current_cuser.show_sorted():
|
|
|
|
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate.desc())
|
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
|
title=_(u"Newest Books"))
|
|
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
@app.route('/books/oldest', defaults={'page': 1})
|
|
|
|
|
@app.route('/books/oldest/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def oldest_books(page):
|
|
|
|
|
if current_cuser.show_sorted():
|
|
|
|
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.pubdate)
|
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
|
title=_(u"Oldest Books"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/books/a-z', defaults={'page': 1})
|
|
|
|
|
@app.route('/books/a-z/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def titles_ascending(page):
|
|
|
|
|
if current_cuser.show_sorted():
|
|
|
|
|
entries, random, pagination = fill_indexpage(page, db.Books, True, db.Books.sort)
|
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
|
title=_(u"Books (A-Z)"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/books/z-a', defaults={'page': 1})
|
|
|
|
@ -1082,6 +1090,7 @@ def titles_descending(page):
|
|
|
|
|
@app.route('/hot/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def hot_books(page):
|
|
|
|
|
if current_user.show_hot_books():
|
|
|
|
|
if current_user.show_detail_random():
|
|
|
|
|
random = db.session.query(db.Books).filter(common_filters())\
|
|
|
|
|
.order_by(func.random()).limit(config.config_random_books)
|
|
|
|
@ -1103,36 +1112,46 @@ def hot_books(page):
|
|
|
|
|
pagination = Pagination(page, config.config_books_per_page, numBooks)
|
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
|
title=_(u"Hot Books (most downloaded)"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/rated", defaults={'page': 1})
|
|
|
|
|
@app.route('/rated/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def best_rated_books(page):
|
|
|
|
|
if current_user.show_best_rated_books():
|
|
|
|
|
entries, random, pagination = fill_indexpage(page, db.Books, db.Books.ratings.any(db.Ratings.rating > 9),
|
|
|
|
|
db.Books.timestamp.desc())
|
|
|
|
|
return render_title_template('index.html', random=random, entries=entries, pagination=pagination,
|
|
|
|
|
title=_(u"Best rated books"))
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/discover", defaults={'page': 1})
|
|
|
|
|
@app.route('/discover/page/<int:page>')
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def discover(page):
|
|
|
|
|
if current_user.show_random_books():
|
|
|
|
|
entries, __, pagination = fill_indexpage(page, db.Books, True, func.randomblob(2))
|
|
|
|
|
pagination = Pagination(1, config.config_books_per_page,config.config_books_per_page)
|
|
|
|
|
return render_title_template('discover.html', entries=entries, pagination=pagination, title=_(u"Random Books"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/author")
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def author_list():
|
|
|
|
|
if current_user.show_author():
|
|
|
|
|
entries = db.session.query(db.Authors, func.count('books_authors_link.book').label('count'))\
|
|
|
|
|
.join(db.books_authors_link).join(db.Books).filter(common_filters())\
|
|
|
|
|
.group_by('books_authors_link.author').order_by(db.Authors.sort).all()
|
|
|
|
|
for entry in entries:
|
|
|
|
|
entry.Authors.name=entry.Authors.name.replace('|',',')
|
|
|
|
|
return render_title_template('list.html', entries=entries, folder='author', title=_(u"Author list"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/author/<int:book_id>", defaults={'page': 1})
|
|
|
|
@ -1181,10 +1200,13 @@ def get_unique_other_books(library_books, author_books):
|
|
|
|
|
@app.route("/series")
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def series_list():
|
|
|
|
|
if current_user.show_series():
|
|
|
|
|
entries = db.session.query(db.Series, func.count('books_series_link.book').label('count'))\
|
|
|
|
|
.join(db.books_series_link).join(db.Books).filter(common_filters())\
|
|
|
|
|
.group_by('books_series_link.series').order_by(db.Series.sort).all()
|
|
|
|
|
return render_title_template('list.html', entries=entries, folder='series', title=_(u"Series list"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/series/<int:book_id>/", defaults={'page': 1})
|
|
|
|
@ -1205,6 +1227,7 @@ def series(book_id, page):
|
|
|
|
|
@app.route("/language")
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def language_overview():
|
|
|
|
|
if current_user.show_language():
|
|
|
|
|
if current_user.filter_language() == u"all":
|
|
|
|
|
languages = db.session.query(db.Languages).all()
|
|
|
|
|
for lang in languages:
|
|
|
|
@ -1229,6 +1252,8 @@ def language_overview():
|
|
|
|
|
'books_languages_link.lang_code').all()
|
|
|
|
|
return render_title_template('languages.html', languages=languages, lang_counter=lang_counter,
|
|
|
|
|
title=_(u"Available languages"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/language/<name>", defaults={'page': 1})
|
|
|
|
@ -1249,10 +1274,13 @@ def language(name, page):
|
|
|
|
|
@app.route("/category")
|
|
|
|
|
@login_required_if_no_ano
|
|
|
|
|
def category_list():
|
|
|
|
|
if current_user.show_category():
|
|
|
|
|
entries = db.session.query(db.Tags, func.count('books_tags_link.book').label('count'))\
|
|
|
|
|
.join(db.books_tags_link).join(db.Books).order_by(db.Tags.name).filter(common_filters())\
|
|
|
|
|
.group_by('books_tags_link.tag').all()
|
|
|
|
|
return render_title_template('list.html', entries=entries, folder='category', title=_(u"Category list"))
|
|
|
|
|
else:
|
|
|
|
|
abort(404)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route("/category/<int:book_id>", defaults={'page': 1})
|
|
|
|
@ -2307,6 +2335,10 @@ def profile():
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_SERIES
|
|
|
|
|
if "show_category" in to_save:
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_CATEGORY
|
|
|
|
|
if "show_recent" in to_save:
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_RECENT
|
|
|
|
|
if "show_sorted" in to_save:
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_SORTED
|
|
|
|
|
if "show_hot" in to_save:
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_HOT
|
|
|
|
|
if "show_best_rated" in to_save:
|
|
|
|
@ -2689,6 +2721,16 @@ def edit_user(user_id):
|
|
|
|
|
elif "show_category" not in to_save and content.show_category():
|
|
|
|
|
content.sidebar_view -= ub.SIDEBAR_CATEGORY
|
|
|
|
|
|
|
|
|
|
if "show_recent" in to_save and not content.show_recent():
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_RECENT
|
|
|
|
|
elif "show_recent" not in to_save and content.show_recent():
|
|
|
|
|
content.sidebar_view -= ub.SIDEBAR_RECENT
|
|
|
|
|
|
|
|
|
|
if "show_sorted" in to_save and not content.show_sorted():
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_SORTED
|
|
|
|
|
elif "show_sorted" not in to_save and content.show_sorted():
|
|
|
|
|
content.sidebar_view -= ub.SIDEBAR_SORTED
|
|
|
|
|
|
|
|
|
|
if "show_hot" in to_save and not content.show_hot_books():
|
|
|
|
|
content.sidebar_view += ub.SIDEBAR_HOT
|
|
|
|
|
elif "show_hot" not in to_save and content.show_hot_books():
|
|
|
|
|