Discover now shows Comics instead of Issues, no images yet though

pull/458/head
Tailchakra 7 years ago
parent 8a85dd9333
commit 25033ca3b3

@ -71,14 +71,7 @@
</div>
</div>
<h2>{{entry.title}}</h2>
<p class="author">
{% for author in entry.authors %}
<a href="{{url_for('author', book_id=author.id ) }}">{{author.name.replace('|',',')}}</a>
{% if not loop.last %}
&amp;
{% endif %}
{% endfor %}
</p>
{% if entry.ratings.__len__() > 0 %}
<div class="rating">
<p>

@ -1,36 +1,25 @@
{% extends "layout.html" %}
{% block body %}
<div class="discover load-more">
<h2>{{title}}</h2>
<div class="row">
<h2>{{title}}</h2>
<div class="row">
{% for entry in entries %}
<div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover">
{% if entry.has_cover is defined %}
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="{{ entry.title }}" />
</a>
{% endif %}
</div>
<div class="meta">
<p class="title">{{entry.title|shortentitle}}</p>
<p class="author"><a href="{{url_for('author', book_id=entry.authors[0].id) }}">{{entry.authors[0].name}}</a></p>
{% if entry.ratings.__len__() > 0 %}
<div class="rating">
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
<span class="glyphicon glyphicon-star good"></span>
{% if loop.last and loop.index < 5 %}
{% for numer in range(5 - loop.index) %}
<span class="glyphicon glyphicon-star"></span>
{% endfor %}
{% endif %}
{% endfor %}
{% for entry in entries %}
<div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover">
{% if entry.has_cover is defined %}
<a href="{{url_for('series', book_id=entry.id)}}">
<img src="{{ url_for('get_cover', cover_path=entry.book[0].path.replace('\\','/')) }}"
alt="{{ entry.title }}"/>
</a>
{% endif %}
</div>
<div class="meta">
<p class="title"><a href="{{url_for('series', book_id=entry.id)}}">{{entry.name}}</a></p>
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}

@ -142,8 +142,8 @@
{% if g.user.show_series() %}
<li id="nav_serie"><a href="{{url_for('series_list')}}"><span class="glyphicon glyphicon-bookmark"></span> {{_('Comics')}}</a></li>
{%endif%}
{% if g.user.show_author() %}
<li id="nav_author"><a href="{{url_for('author_list')}}"><span class="glyphicon glyphicon-user"></span> {{_('Publishers')}}</a></li>
{% if g.user.show_publisher() %}
<li id="nav_author"><a href="{{url_for('publisher_list')}}"><span class="glyphicon glyphicon-user"></span> {{_('Publishers')}}</a></li>
{%endif%}
{% if g.user.filter_language() == 'all' and g.user.show_language() %}
<li id="nav_lang"><a href="{{url_for('language_overview')}}"><span class="glyphicon glyphicon-flag"></span> {{_('Languages')}} </a></li>
@ -200,7 +200,7 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="bookDetailsModalLabel">{{_('Book Details')}}</h4>
<h4 class="modal-title" id="bookDetailsModalLabel">{{_('Issue Details')}}</h4>
</div>
<div class="modal-body">...</div>
<div class="modal-footer">

@ -0,0 +1,106 @@
{% extends "layout.html" %}
{% block body %}
<h2>{{title}}</h2>
{% if publisher is not none %}
<section class="publisher-bio">
{%if publisher.image_url is not none %}
<img src="{{publisher.image_url}}" alt="{{publisher.name|safe}}" class="publisher-photo pull-left">
{% endif %}
{%if publisher.about is not none %}
<p>{{publisher.about|safe}}</p>
{% endif %}
- {{_("via")}} <a href="{{publisher.link}}" class="publisher-link" target="_blank" rel="noopener">Goodreads</a>
</section>
<div class="clearfix"></div>
{% endif %}
<div class="discover load-more">
{% if publisher is not none %}
<h3>{{_("In Library")}}</h3>
{% endif %}
<div class="row">
{% if entries[0] %}
{% for entry in entries %}
<div id="books" class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover">
<a href="{{ url_for('show_book', book_id=entry.id) }}" data-toggle="modal" data-target="#bookDetailsModal" data-remote="false">
<img src="{{ url_for('get_cover', cover_path=entry.path.replace('\\','/')) }}" alt="{{ entry.title }}" />
</a>
</div>
<div class="meta">
<p class="title">{{entry.title|shortentitle}}</p>
<p class="publisher">
{% for publisher in entry.publishers %}
<a href="{{url_for('publisher', book_id=publisher.id) }}">{{publisher.name.replace('|',',')}}</a>
{% if not loop.last %}
&amp;
{% endif %}
{% endfor %}
</p>
{% if entry.ratings.__len__() > 0 %}
<div class="rating">
{% for number in range((entry.ratings[0].rating/2)|int(2)) %}
<span class="glyphicon glyphicon-star good"></span>
{% if loop.last and loop.index < 5 %}
{% for numer in range(5 - loop.index) %}
<span class="glyphicon glyphicon-star"></span>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
</div>
{% endfor %}
{% endif %}
</div>
</div>
{% if other_books %}
<div class="discover">
<h3>{{_("More by")}} {{ publisher.name.replace('|',',')|safe }}</h3>
<div class="row">
{% for entry in other_books %}
<div class="col-sm-3 col-lg-2 col-xs-6 book">
<div class="cover">
<a href="https://www.goodreads.com/book/show/{{ entry.gid['#text'] }}" target="_blank" rel="noopener">
<img src="{{ entry.image_url }}" />
</a>
</div>
<div class="meta">
<p class="title">{{entry.title|shortentitle}}</p>
<p class="publisher">
{% for publisher in entry.publishers %}
<a href="https://www.goodreads.com/publisher/show/{{ publisher.gid }}" target="_blank" rel="noopener">
{{publisher.name.replace('|',',')}}
</a>
{% if not loop.last %}
&amp;
{% endif %}
{% endfor %}
</p>
<div class="rating">
{% for number in range((entry.average_rating)|float|round|int(2)) %}
<span class="glyphicon glyphicon-star good"></span>
{% if loop.last and loop.index < 5 %}
{% for numer in range(5 - loop.index) %}
<span class="glyphicon glyphicon-star"></span>
{% endfor %}
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
<a href="{{publisher.link}}" class="publisher-link" target="_blank" rel="noopener">
<img src="{{ url_for('static', filename='img/goodreads.svg') }}" alt="Goodreads">
</a>
</div>
{% endif %}
{% endblock %}

@ -74,8 +74,8 @@
<label for="show_category">{{_('Show category selection')}}</label>
</div>
<div class="form-group">
<input type="checkbox" name="show_author" id="show_author" {% if content.show_author() %}checked{% endif %}>
<label for="show_author">{{_('Show publisher selection')}}</label>
<input type="checkbox" name="show_publisher" id="show_publisher" {% if content.show_publisher() %}checked{% endif %}>
<label for="show_publisher">{{_('Show publisher selection')}}</label>
</div>
<div class="form-group">
<input type="checkbox" name="show_read_and_unread" id="show_read_and_unread" {% if content.show_read_and_unread() %}checked{% endif %}>

@ -135,7 +135,7 @@ class UserBase:
def show_category(self):
return bool((self.sidebar_view is not None)and(self.sidebar_view & SIDEBAR_CATEGORY == SIDEBAR_CATEGORY))
def show_author(self):
def show_publisher(self):
return bool((self.sidebar_view is not None)and(self.sidebar_view & SIDEBAR_AUTHOR == SIDEBAR_AUTHOR))
def show_best_rated_books(self):

@ -1285,23 +1285,23 @@ def best_rated_books(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))
entries, __, pagination = fill_indexpage(page, db.Series, 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 Issues"))
return render_title_template('discover.html', entries=entries, pagination=pagination, title=_(u"Random Comics"))
else:
abort(404)
@app.route("/publisher")
@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()
def publisher_list():
if current_user.show_publisher():
entries = db.session.query(db.Publishers, func.count('books_publishers_link.book').label('count'))\
.join(db.books_publishers_link).join(db.Books).filter(common_filters())\
.group_by('books_publishers_link.publisher').order_by(db.Publishers.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"Publisher list"))
entry.Publishers.name=entry.Publishers.name.replace('|',',')
return render_title_template('list.html', entries=entries, folder='publisher', title=_(u"Publisher list"))
else:
abort(404)
@ -1309,24 +1309,24 @@ def author_list():
@app.route("/publisher/<int:book_id>", defaults={'page': 1})
@app.route("/publisher/<int:book_id>/<int:page>'")
@login_required_if_no_ano
def author(book_id, page):
entries, __, pagination = fill_indexpage(page, db.Books, db.Books.authors.any(db.Authors.id == book_id),
def publisher(book_id, page):
entries, __, pagination = fill_indexpage(page, db.Books, db.Books.publishers.any(db.Publishers.id == book_id),
db.Books.timestamp.desc())
if entries is None:
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
return redirect(url_for("index"))
name = (db.session.query(db.Authors).filter(db.Authors.id == book_id).first().name).replace('|',',')
name = (db.session.query(db.Publishers).filter(db.Publishers.id == book_id).first().name).replace('|',',')
author_info = None
publisher_info = None
other_books = []
if goodreads_support and config.config_use_goodreads:
gc = GoodreadsClient(config.config_goodreads_api_key, config.config_goodreads_api_secret)
author_info = gc.find_author(author_name=name)
other_books = get_unique_other_books(entries.all(), author_info.books)
publisher_info = gc.find_publisher(publisher_name=name)
other_books = get_unique_other_books(entries.all(), publisher_info.books)
return render_title_template('author.html', entries=entries, pagination=pagination,
title=name, author=author_info, other_books=other_books)
return render_title_template('publisher.html', entries=entries, pagination=pagination,
title=name, publisher=publisher_info, other_books=other_books)
def get_unique_other_issues(library_books, author_books):
@ -1914,14 +1914,14 @@ def feed_read_books():
return render_read_books(int(off) / (int(config.config_books_per_page)) + 1, True, True)
@app.route("/readissues/", defaults={'page': 1})
@app.route("/readissues/<int:page>'")
@app.route("/readbooks/", defaults={'page': 1})
@app.route("/readbooks/<int:page>'")
@login_required_if_no_ano
def read_books(page):
return render_read_books(page, True)
@app.route("/opds/unreadissues/")
@app.route("/opds/unreadbooks/")
@login_required_if_no_ano
def feed_unread_books():
off = request.args.get("offset")
@ -1930,8 +1930,8 @@ def feed_unread_books():
return render_read_books(int(off) / (int(config.config_books_per_page)) + 1, False, True)
@app.route("/unreadissues/", defaults={'page': 1})
@app.route("/unreadissues/<int:page>'")
@app.route("/unreadbooks/", defaults={'page': 1})
@app.route("/unreadbooks/<int:page>'")
@login_required_if_no_ano
def unread_books(page):
return render_read_books(page, False)
@ -2434,7 +2434,7 @@ def profile():
content.sidebar_view += ub.SIDEBAR_HOT
if "show_best_rated" in to_save:
content.sidebar_view += ub.SIDEBAR_BEST_RATED
if "show_author" in to_save:
if "show_publisher" in to_save:
content.sidebar_view += ub.SIDEBAR_AUTHOR
if "show_read_and_unread" in to_save:
content.sidebar_view += ub.SIDEBAR_READ_AND_UNREAD
@ -2664,7 +2664,7 @@ def new_user():
content.sidebar_view += ub.SIDEBAR_RANDOM
if "show_language" in to_save:
content.sidebar_view += ub.SIDEBAR_LANGUAGE
if "show_comics" in to_save:
if "show_series" in to_save:
content.sidebar_view += ub.SIDEBAR_SERIES
if "show_category" in to_save:
content.sidebar_view += ub.SIDEBAR_CATEGORY
@ -2852,9 +2852,9 @@ def edit_user(user_id):
elif "show_read_and_unread" not in to_save and content.show_read_and_unread():
content.sidebar_view -= ub.SIDEBAR_READ_AND_UNREAD
if "show_author" in to_save and not content.show_author():
if "show_publisher" in to_save and not content.show_publisher():
content.sidebar_view += ub.SIDEBAR_AUTHOR
elif "show_author" not in to_save and content.show_author():
elif "show_publisher" not in to_save and content.show_publisher():
content.sidebar_view -= ub.SIDEBAR_AUTHOR
if "show_detail_random" in to_save and not content.show_detail_random():
@ -2883,7 +2883,7 @@ def edit_user(user_id):
title=_(u"Edit User %(nick)s", nick=content.nickname))
@app.route("/admin/issue/<int:book_id>", methods=['GET', 'POST'])
@app.route("/admin/book/<int:book_id>", methods=['GET', 'POST'])
@login_required_if_no_ano
@edit_required
def edit_book(book_id):

@ -14,7 +14,7 @@ Calibre Web is a web app providing a clean interface for browsing, reading and d
- Admin interface
- User Interface in dutch, english, french, german, italian, polish, russian, simplified chinese, spanish
- OPDS feed for eBook reader apps
- Filter and search by titles, authors, tags, series and language
- Filter and search by titles, publishers, tags, series and language
- Create custom book collection (shelves)
- Support for editing eBook metadata and deleting eBooks from Calibre library
- Support for converting eBooks from EPUB to Kindle format (mobi/azw)

Loading…
Cancel
Save