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
ab534b21
Commit
ab534b21
authored
Apr 02, 2017
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cosmetics
parent
7dd70db8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
db.py
cps/db.py
+11
-11
helper.py
cps/helper.py
+1
-1
ub.py
cps/ub.py
+2
-4
No files found.
cps/db.py
View file @
ab534b21
...
@@ -67,9 +67,9 @@ class Identifiers(Base):
...
@@ -67,9 +67,9 @@ class Identifiers(Base):
val
=
Column
(
String
)
val
=
Column
(
String
)
book
=
Column
(
Integer
,
ForeignKey
(
'books.id'
))
book
=
Column
(
Integer
,
ForeignKey
(
'books.id'
))
def
__init__
(
self
,
val
,
type
,
book
):
def
__init__
(
self
,
val
,
id_
type
,
book
):
self
.
val
=
val
self
.
val
=
val
self
.
type
=
type
self
.
type
=
id_
type
self
.
book
=
book
self
.
book
=
book
def
formatType
(
self
):
def
formatType
(
self
):
...
@@ -209,9 +209,9 @@ class Data(Base):
...
@@ -209,9 +209,9 @@ class Data(Base):
uncompressed_size
=
Column
(
Integer
)
uncompressed_size
=
Column
(
Integer
)
name
=
Column
(
String
)
name
=
Column
(
String
)
def
__init__
(
self
,
book
,
format
,
uncompressed_size
,
name
):
def
__init__
(
self
,
book
,
book_
format
,
uncompressed_size
,
name
):
self
.
book
=
book
self
.
book
=
book
self
.
format
=
format
self
.
format
=
book_
format
self
.
uncompressed_size
=
uncompressed_size
self
.
uncompressed_size
=
uncompressed_size
self
.
name
=
name
self
.
name
=
name
...
@@ -274,7 +274,7 @@ class Custom_Columns(Base):
...
@@ -274,7 +274,7 @@ class Custom_Columns(Base):
display
=
Column
(
String
)
display
=
Column
(
String
)
is_multiple
=
Column
(
Boolean
)
is_multiple
=
Column
(
Boolean
)
normalized
=
Column
(
Boolean
)
normalized
=
Column
(
Boolean
)
def
get_display_dict
(
self
):
def
get_display_dict
(
self
):
display_dict
=
ast
.
literal_eval
(
self
.
display
)
display_dict
=
ast
.
literal_eval
(
self
.
display
)
return
display_dict
return
display_dict
...
@@ -333,15 +333,15 @@ def setup_db():
...
@@ -333,15 +333,15 @@ def setup_db():
'value'
:
Column
(
String
)}
'value'
:
Column
(
String
)}
cc_classes
[
row
.
id
]
=
type
(
'Custom_Column_'
+
str
(
row
.
id
),
(
Base
,),
ccdict
)
cc_classes
[
row
.
id
]
=
type
(
'Custom_Column_'
+
str
(
row
.
id
),
(
Base
,),
ccdict
)
for
id
in
cc_ids
:
for
cc_
id
in
cc_ids
:
if
id
[
1
]
==
'bool'
:
if
cc_
id
[
1
]
==
'bool'
:
setattr
(
Books
,
'custom_column_'
+
str
(
id
[
0
]),
relationship
(
cc_classes
[
id
[
0
]],
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_
id
[
0
]],
primaryjoin
=
(
primaryjoin
=
(
Books
.
id
==
cc_classes
[
id
[
0
]]
.
book
),
Books
.
id
==
cc_classes
[
cc_
id
[
0
]]
.
book
),
backref
=
'books'
))
backref
=
'books'
))
else
:
else
:
setattr
(
Books
,
'custom_column_'
+
str
(
id
[
0
]),
relationship
(
cc_classes
[
id
[
0
]],
setattr
(
Books
,
'custom_column_'
+
str
(
cc_id
[
0
]),
relationship
(
cc_classes
[
cc_
id
[
0
]],
secondary
=
books_custom_column_links
[
id
[
0
]],
secondary
=
books_custom_column_links
[
cc_
id
[
0
]],
backref
=
'books'
))
backref
=
'books'
))
# Base.metadata.create_all(engine)
# Base.metadata.create_all(engine)
...
...
cps/helper.py
View file @
ab534b21
...
@@ -94,7 +94,7 @@ def make_mobi(book_id, calibrepath):
...
@@ -94,7 +94,7 @@ def make_mobi(book_id, calibrepath):
if
not
check
or
check
<
2
:
if
not
check
or
check
<
2
:
book
.
data
.
append
(
db
.
Data
(
book
.
data
.
append
(
db
.
Data
(
name
=
book
.
data
[
0
]
.
name
,
name
=
book
.
data
[
0
]
.
name
,
format
=
"MOBI"
,
book_
format
=
"MOBI"
,
book
=
book
.
id
,
book
=
book
.
id
,
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
".mobi"
)
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
".mobi"
)
))
))
...
...
cps/ub.py
View file @
ab534b21
...
@@ -293,10 +293,8 @@ class Config:
...
@@ -293,10 +293,8 @@ class Config:
else
:
else
:
self
.
config_google_drive_watch_changes_response
=
None
self
.
config_google_drive_watch_changes_response
=
None
self
.
config_columns_to_ignore
=
data
.
config_columns_to_ignore
self
.
config_columns_to_ignore
=
data
.
config_columns_to_ignore
if
self
.
config_calibre_dir
is
not
None
and
(
not
self
.
config_use_google_drive
or
os
.
path
.
exists
(
self
.
config_calibre_dir
+
'/metadata.db'
)):
self
.
db_configured
=
bool
(
self
.
config_calibre_dir
is
not
None
and
self
.
db_configured
=
True
(
not
self
.
config_use_google_drive
or
os
.
path
.
exists
(
self
.
config_calibre_dir
+
'/metadata.db'
)))
else
:
self
.
db_configured
=
False
@
property
@
property
def
get_main_dir
(
self
):
def
get_main_dir
(
self
):
...
...
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