1
0
mirror of https://github.com/janeczku/calibre-web synced 2024-12-25 09:30:31 +00:00

Merge remote-tracking branch 'autoconv/kepub_autoconv' into development

# Conflicts:
#	cps/kobo.py
#	cps/kobo_auth.py
This commit is contained in:
Ozzie Isaacs 2021-01-30 14:47:18 +01:00
commit 7fa5865cf6
2 changed files with 14 additions and 3 deletions

View File

@ -176,6 +176,10 @@ def HandleSyncRequest():
reading_states_in_new_entitlements = []
for book in changed_entries:
formats = [data.format for data in book.Books.data]
if not 'KEPUB' in formats and config.config_kepubifypath and 'EPUB' in formats:
helper.convert_book_format(book.id, config.config_calibre_dir, 'EPUB', 'KEPUB', current_user.nickname)
kobo_reading_state = get_or_create_reading_state(book.Books.id)
entitlement = {
"BookEntitlement": create_book_entitlement(book.Books, archived=(book.is_archived == True)),
@ -1004,7 +1008,6 @@ def HandleInitRequest():
@requires_kobo_auth
@download_required
def download_book(book_id, book_format):
return get_download_link(book_id, book_format, "kobo")

View File

@ -64,10 +64,10 @@ from datetime import datetime
from os import urandom
from flask import g, Blueprint, url_for, abort, request
from flask_login import login_user, login_required
from flask_login import login_user, current_user, login_required
from flask_babel import gettext as _
from . import logger, ub, lm
from . import logger, config, calibre_db, db, helper, ub, lm
from .render_template import render_title_template
try:
@ -148,6 +148,14 @@ def generate_auth_token(user_id):
ub.session.add(auth_token)
ub.session_commit()
books = calibre_db.session.query(db.Books).join(db.Data).all()
for book in books:
formats = [data.format for data in book.data]
if not 'KEPUB' in formats and config.config_kepubifypath and 'EPUB' in formats:
helper.convert_book_format(book.id, config.config_calibre_dir, 'EPUB', 'KEPUB', current_user.nickname)
return render_title_template(
"generate_kobo_auth_url.html",
title=_(u"Kobo Setup"),