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
d6a97468
Commit
d6a97468
authored
Dec 20, 2019
by
Michael Shavit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a filter to the Sync request endpoint to ignore books that don't
have any formats supported by the device.
parent
f84274f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
kobo.py
cps/kobo.py
+6
-2
No files found.
cps/kobo.py
View file @
d6a97468
...
...
@@ -33,6 +33,9 @@ from sqlalchemy import func
from
.
import
config
,
logger
,
kobo_auth
,
db
,
helper
from
.web
import
download_required
#TODO: Test more formats :) .
KOBO_SUPPORTED_FORMATS
=
{
"KEPUB"
}
kobo
=
Blueprint
(
"kobo"
,
__name__
,
url_prefix
=
"/kobo/<auth_token>"
)
kobo_auth
.
disable_failed_auth_redirect_for_blueprint
(
kobo
)
kobo_auth
.
register_url_value_preprocessor
(
kobo
)
...
...
@@ -169,7 +172,9 @@ def HandleSyncRequest():
# the comparison because of the +00:00 suffix.
changed_entries
=
(
db
.
session
.
query
(
db
.
Books
)
.
join
(
db
.
Data
)
.
filter
(
func
.
datetime
(
db
.
Books
.
last_modified
)
>
sync_token
.
books_last_modified
)
.
filter
(
db
.
Data
.
format
.
in_
(
KOBO_SUPPORTED_FORMATS
))
.
all
()
)
for
book
in
changed_entries
:
...
...
@@ -275,11 +280,10 @@ def get_series(book):
def
get_metadata
(
book
):
ALLOWED_FORMATS
=
{
"KEPUB"
}
download_urls
=
[]
for
book_data
in
book
.
data
:
if
book_data
.
format
in
ALLOW
ED_FORMATS
:
if
book_data
.
format
in
KOBO_SUPPORT
ED_FORMATS
:
download_urls
.
append
(
{
"Format"
:
book_data
.
format
,
...
...
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