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
4368c182
Commit
4368c182
authored
May 06, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make goodreads compatible for betterreads dependency
parent
48f4b12c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
goodreads_support.py
cps/services/goodreads_support.py
+11
-4
No files found.
cps/services/goodreads_support.py
View file @
4368c182
...
...
@@ -20,7 +20,10 @@ from __future__ import division, print_function, unicode_literals
import
time
from
functools
import
reduce
from
goodreads.client
import
GoodreadsClient
try
:
from
goodreads.client
import
GoodreadsClient
except
ImportError
:
from
betterreads.client
import
GoodreadsClient
try
:
import
Levenshtein
except
ImportError
:
Levenshtein
=
False
...
...
@@ -54,7 +57,7 @@ def connect(key=None, secret=None, enabled=True):
def
get_author_info
(
author_name
):
now
=
time
.
time
()
author_info
=
_AUTHORS_CACHE
.
get
(
author_name
,
None
)
author_info
=
None
#
_AUTHORS_CACHE.get(author_name, None)
if
author_info
:
if
now
<
author_info
.
_timestamp
+
_CACHE_TIMEOUT
:
return
author_info
...
...
@@ -95,6 +98,10 @@ def get_other_books(author_info, library_books=None):
for
book
in
author_info
.
books
:
if
book
.
isbn
in
identifiers
:
continue
if
isinstance
(
book
.
gid
,
int
):
if
book
.
gid
in
identifiers
:
continue
else
:
if
book
.
gid
[
"#text"
]
in
identifiers
:
continue
...
...
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