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
4d44746a
Commit
4d44746a
authored
Aug 15, 2020
by
Ozzie Isaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change settings database gdrive watch to JSON
parent
ecb160b2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
12 deletions
+3
-12
config_sql.py
cps/config_sql.py
+2
-10
gdrive.py
cps/gdrive.py
+1
-2
No files found.
cps/config_sql.py
View file @
4d44746a
...
...
@@ -22,7 +22,7 @@ import os
import
json
import
sys
from
sqlalchemy
import
exc
,
Column
,
String
,
Integer
,
SmallInteger
,
Boolean
,
BLOB
from
sqlalchemy
import
exc
,
Column
,
String
,
Integer
,
SmallInteger
,
Boolean
,
BLOB
,
JSON
from
sqlalchemy.ext.declarative
import
declarative_base
from
.
import
constants
,
cli
,
logger
,
ub
...
...
@@ -92,7 +92,7 @@ class _Settings(_Base):
config_use_google_drive
=
Column
(
Boolean
,
default
=
False
)
config_google_drive_folder
=
Column
(
String
)
config_google_drive_watch_changes_response
=
Column
(
String
)
config_google_drive_watch_changes_response
=
Column
(
JSON
,
default
=
{}
)
config_use_goodreads
=
Column
(
Boolean
,
default
=
False
)
config_goodreads_api_key
=
Column
(
String
)
...
...
@@ -280,10 +280,6 @@ class _ConfigSQL(object):
v
=
column
.
default
.
arg
setattr
(
self
,
k
,
v
)
if
self
.
config_google_drive_watch_changes_response
:
self
.
config_google_drive_watch_changes_response
=
\
json
.
loads
(
self
.
config_google_drive_watch_changes_response
)
have_metadata_db
=
bool
(
self
.
config_calibre_dir
)
if
have_metadata_db
:
if
not
self
.
config_use_google_drive
:
...
...
@@ -302,10 +298,6 @@ class _ConfigSQL(object):
'''Apply all configuration values to the underlying storage.'''
s
=
self
.
_read_from_storage
()
# type: _Settings
if
self
.
config_google_drive_watch_changes_response
:
self
.
config_google_drive_watch_changes_response
=
json
.
dumps
(
self
.
config_google_drive_watch_changes_response
)
for
k
,
v
in
self
.
__dict__
.
items
():
if
k
[
0
]
==
'_'
:
continue
...
...
cps/gdrive.py
View file @
4d44746a
...
...
@@ -93,8 +93,7 @@ def watch_gdrive():
try
:
result
=
gdriveutils
.
watchChange
(
gdriveutils
.
Gdrive
.
Instance
()
.
drive
,
notification_id
,
'web_hook'
,
address
,
gdrive_watch_callback_token
,
current_milli_time
()
+
604800
*
1000
)
# config.config_google_drive_watch_changes_response = json.dumps(result)
# after save(), config_google_drive_watch_changes_response will be a json object, not string
config
.
config_google_drive_watch_changes_response
=
result
config
.
save
()
except
HttpError
as
e
:
reason
=
json
.
loads
(
e
.
content
)[
'error'
][
'errors'
][
0
]
...
...
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