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
e012726c
Commit
e012726c
authored
Sep 06, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1461 (parse Amazon_* identifiers)
parent
d3bde040
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
16 deletions
+24
-16
db.py
cps/db.py
+24
-16
No files found.
cps/db.py
View file @
e012726c
...
...
@@ -100,41 +100,49 @@ class Identifiers(Base):
self
.
book
=
book
def
formatType
(
self
):
if
self
.
type
==
"amazon"
:
format_type
=
self
.
type
.
lower
()
if
format_type
==
'amazon'
:
return
u"Amazon"
elif
self
.
type
==
"isbn"
:
elif
format_type
.
startswith
(
"amazon_"
):
return
u"Amazon.{0}"
.
format
(
format_type
[
7
:])
elif
format_type
==
"isbn"
:
return
u"ISBN"
elif
self
.
type
==
"doi"
:
elif
format_
type
==
"doi"
:
return
u"DOI"
elif
self
.
type
==
"goodreads"
:
elif
format_type
==
"douban"
:
return
u"Douban"
elif
format_type
==
"goodreads"
:
return
u"Goodreads"
elif
self
.
type
==
"google"
:
elif
format_
type
==
"google"
:
return
u"Google Books"
elif
self
.
type
==
"kobo"
:
elif
format_
type
==
"kobo"
:
return
u"Kobo"
if
self
.
type
==
"lubimyczytac"
:
if
format_
type
==
"lubimyczytac"
:
return
u"Lubimyczytac"
else
:
return
self
.
type
def
__repr__
(
self
):
if
self
.
type
==
"amazon"
or
self
.
type
==
"asin"
:
format_type
=
self
.
type
.
lower
()
if
format_type
==
"amazon"
or
format_type
==
"asin"
:
return
u"https://amzn.com/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"isbn"
:
elif
format_type
.
startswith
(
'amazon_'
):
return
u"https://amazon.{0}/{1}"
.
format
(
format_type
[
7
:],
self
.
val
)
elif
format_type
==
"isbn"
:
return
u"https://www.worldcat.org/isbn/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"doi"
:
elif
format_
type
==
"doi"
:
return
u"https://dx.doi.org/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"goodreads"
:
elif
format_
type
==
"goodreads"
:
return
u"https://www.goodreads.com/book/show/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"douban"
:
elif
format_
type
==
"douban"
:
return
u"https://book.douban.com/subject/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"google"
:
elif
format_
type
==
"google"
:
return
u"https://books.google.com/books?id={0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"kobo"
:
elif
format_
type
==
"kobo"
:
return
u"https://www.kobo.com/ebook/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"lubimyczytac"
:
elif
format_
type
==
"lubimyczytac"
:
return
u" https://lubimyczytac.pl/ksiazka/{0}"
.
format
(
self
.
val
)
elif
self
.
type
==
"url"
:
elif
format_
type
==
"url"
:
return
u"{0}"
.
format
(
self
.
val
)
else
:
return
u""
...
...
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