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
46197d82
Commit
46197d82
authored
May 24, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edit and Upload books refactored
parent
e4eab175
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
111 deletions
+126
-111
db.py
cps/db.py
+13
-11
editbooks.py
cps/editbooks.py
+110
-97
isoLanguages.py
cps/isoLanguages.py
+3
-3
No files found.
cps/db.py
View file @
46197d82
...
...
@@ -437,20 +437,22 @@ class CalibreDB(threading.Thread):
for
cc_id
in
cc_ids
:
if
(
cc_id
[
1
]
==
'bool'
)
or
(
cc_id
[
1
]
==
'int'
)
or
(
cc_id
[
1
]
==
'float'
):
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_id
[
0
]],
primaryjoin
=
(
Books
.
id
==
cc_classes
[
cc_id
[
0
]]
.
book
),
backref
=
'books'
))
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_id
[
0
]],
primaryjoin
=
(
Books
.
id
==
cc_classes
[
cc_id
[
0
]]
.
book
),
backref
=
'books'
))
else
:
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_id
[
0
]],
secondary
=
books_custom_column_links
[
cc_id
[
0
]],
backref
=
'books'
))
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_id
[
0
]],
secondary
=
books_custom_column_links
[
cc_id
[
0
]],
backref
=
'books'
))
# global session
Session
=
scoped_session
(
sessionmaker
(
autocommit
=
False
,
autoflush
=
False
,
bind
=
self
.
engine
))
autoflush
=
False
,
bind
=
self
.
engine
))
self
.
session
=
Session
()
return
True
...
...
cps/editbooks.py
View file @
46197d82
This diff is collapsed.
Click to expand it.
cps/isoLanguages.py
View file @
46197d82
...
...
@@ -57,12 +57,12 @@ def get_language_name(locale, lang_code):
def
get_language_codes
(
locale
,
language_names
,
remainder
=
None
):
language_names
=
set
(
x
.
strip
()
.
lower
()
for
x
in
language_names
if
x
)
languages
=
list
()
for
k
,
v
in
get_language_names
(
locale
)
.
items
():
v
=
v
.
lower
()
if
v
in
language_names
:
languages
.
append
(
k
)
language_names
.
remove
(
v
)
yield
k
if
remainder
is
not
None
:
remainder
.
extend
(
language_names
)
return
languages
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