Fixes for kobo sync
This commit is contained in:
parent
e1987c34d9
commit
dcab8af8ab
12
cps/kobo.py
12
cps/kobo.py
@ -153,13 +153,23 @@ def HandleSyncRequest():
|
|||||||
# in case of external changes (e.g: adding a book through Calibre).
|
# in case of external changes (e.g: adding a book through Calibre).
|
||||||
calibre_db.reconnect_db(config, ub.app_DB_path)
|
calibre_db.reconnect_db(config, ub.app_DB_path)
|
||||||
|
|
||||||
|
if sync_token.books_last_id > -1:
|
||||||
changed_entries = (
|
changed_entries = (
|
||||||
calibre_db.session.query(db.Books, ub.ArchivedBook.last_modified, ub.ArchivedBook.is_archived)
|
calibre_db.session.query(db.Books, ub.ArchivedBook.last_modified, ub.ArchivedBook.is_archived)
|
||||||
.join(db.Data).outerjoin(ub.ArchivedBook, db.Books.id == ub.ArchivedBook.book_id)
|
.join(db.Data).outerjoin(ub.ArchivedBook, db.Books.id == ub.ArchivedBook.book_id)
|
||||||
.filter(db.Books.last_modified >= sync_token.books_last_modified)
|
.filter(db.Books.last_modified >= sync_token.books_last_modified)
|
||||||
.filter(db.Books.id>sync_token.books_last_id)
|
.filter(db.Books.id>sync_token.books_last_id)
|
||||||
.filter(db.Data.format.in_(KOBO_FORMATS))
|
.filter(db.Data.format.in_(KOBO_FORMATS))
|
||||||
# .filter(ub.ArchivedBook.is_archived == 0)
|
.order_by(db.Books.last_modified)
|
||||||
|
.order_by(db.Books.id)
|
||||||
|
.limit(SYNC_ITEM_LIMIT)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
changed_entries = (
|
||||||
|
calibre_db.session.query(db.Books, ub.ArchivedBook.last_modified, ub.ArchivedBook.is_archived)
|
||||||
|
.join(db.Data).outerjoin(ub.ArchivedBook, db.Books.id == ub.ArchivedBook.book_id)
|
||||||
|
.filter(db.Books.last_modified > sync_token.books_last_modified)
|
||||||
|
.filter(db.Data.format.in_(KOBO_FORMATS))
|
||||||
.order_by(db.Books.last_modified)
|
.order_by(db.Books.last_modified)
|
||||||
.order_by(db.Books.id)
|
.order_by(db.Books.id)
|
||||||
.limit(SYNC_ITEM_LIMIT)
|
.limit(SYNC_ITEM_LIMIT)
|
||||||
|
Loading…
Reference in New Issue
Block a user