Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
douban-api-proxy
Commits
8fe76270
Commit
8fe76270
authored
Feb 06, 2021
by
alfred82santa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mistake
parent
a3f17deb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
kobo.py
cps/kobo.py
+5
-5
No files found.
cps/kobo.py
View file @
8fe76270
...
@@ -165,14 +165,14 @@ def HandleSyncRequest():
...
@@ -165,14 +165,14 @@ def HandleSyncRequest():
if
sync_token
.
books_last_id
>
-
1
:
if
sync_token
.
books_last_id
>
-
1
:
changed_entries
=
changed_entries
.
filter
(
db
.
Books
.
id
>
sync_token
.
books_last_id
)
changed_entries
=
changed_entries
.
filter
(
db
.
Books
.
id
>
sync_token
.
books_last_id
)
only_kobo_shel
f
s
=
(
only_kobo_shel
ve
s
=
(
calibre_db
.
session
.
query
(
ub
.
Shelf
)
calibre_db
.
session
.
query
(
ub
.
Shelf
)
.
filter
(
ub
.
Shelf
.
user_id
==
current_user
.
id
)
.
filter
(
ub
.
Shelf
.
user_id
==
current_user
.
id
)
.
filter
(
ub
.
Shelf
.
kobo_sync
)
.
filter
(
ub
.
Shelf
.
kobo_sync
)
.
count
()
.
count
()
)
>
0
)
>
0
if
only_kobo_shel
f
s
:
if
only_kobo_shel
ve
s
:
changed_entries
=
(
changed_entries
=
(
changed_entries
.
join
(
ub
.
BookShelf
,
db
.
Books
.
id
==
ub
.
BookShelf
.
book_id
)
changed_entries
.
join
(
ub
.
BookShelf
,
db
.
Books
.
id
==
ub
.
BookShelf
.
book_id
)
.
join
(
ub
.
Shelf
)
.
join
(
ub
.
Shelf
)
...
@@ -244,7 +244,7 @@ def HandleSyncRequest():
...
@@ -244,7 +244,7 @@ def HandleSyncRequest():
})
})
new_reading_state_last_modified
=
max
(
new_reading_state_last_modified
,
kobo_reading_state
.
last_modified
)
new_reading_state_last_modified
=
max
(
new_reading_state_last_modified
,
kobo_reading_state
.
last_modified
)
sync_shelves
(
sync_token
,
sync_results
,
only_kobo_shel
fs
=
only_kobo_shelf
s
)
sync_shelves
(
sync_token
,
sync_results
,
only_kobo_shel
ves
=
only_kobo_shelve
s
)
sync_token
.
books_last_created
=
new_books_last_created
sync_token
.
books_last_created
=
new_books_last_created
sync_token
.
books_last_modified
=
new_books_last_modified
sync_token
.
books_last_modified
=
new_books_last_modified
...
@@ -605,7 +605,7 @@ def HandleTagRemoveItem(tag_id):
...
@@ -605,7 +605,7 @@ def HandleTagRemoveItem(tag_id):
# Add new, changed, or deleted shelves to the sync_results.
# Add new, changed, or deleted shelves to the sync_results.
# Note: Public shelves that aren't owned by the user aren't supported.
# Note: Public shelves that aren't owned by the user aren't supported.
def
sync_shelves
(
sync_token
,
sync_results
,
only_kobo_shel
f
s
=
False
):
def
sync_shelves
(
sync_token
,
sync_results
,
only_kobo_shel
ve
s
=
False
):
new_tags_last_modified
=
sync_token
.
tags_last_modified
new_tags_last_modified
=
sync_token
.
tags_last_modified
for
shelf
in
ub
.
session
.
query
(
ub
.
ShelfArchive
)
.
filter
(
func
.
datetime
(
ub
.
ShelfArchive
.
last_modified
)
>
sync_token
.
tags_last_modified
,
for
shelf
in
ub
.
session
.
query
(
ub
.
ShelfArchive
)
.
filter
(
func
.
datetime
(
ub
.
ShelfArchive
.
last_modified
)
>
sync_token
.
tags_last_modified
,
...
@@ -622,7 +622,7 @@ def sync_shelves(sync_token, sync_results, only_kobo_shelfs=False):
...
@@ -622,7 +622,7 @@ def sync_shelves(sync_token, sync_results, only_kobo_shelfs=False):
})
})
extra_filters
=
[]
extra_filters
=
[]
if
only_kobo_shel
f
s
:
if
only_kobo_shel
ve
s
:
for
shelf
in
ub
.
session
.
query
(
ub
.
Shelf
)
.
filter
(
for
shelf
in
ub
.
session
.
query
(
ub
.
Shelf
)
.
filter
(
func
.
datetime
(
ub
.
Shelf
.
last_modified
)
>
sync_token
.
tags_last_modified
,
func
.
datetime
(
ub
.
Shelf
.
last_modified
)
>
sync_token
.
tags_last_modified
,
ub
.
Shelf
.
user_id
==
current_user
.
id
,
ub
.
Shelf
.
user_id
==
current_user
.
id
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment