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
b8137d2c
Commit
b8137d2c
authored
Mar 02, 2017
by
Jack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing error with uploading new book / metadata as file was being backed up
parent
8e85d1b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
web.py
cps/web.py
+5
-3
No files found.
cps/web.py
View file @
b8137d2c
...
...
@@ -51,6 +51,7 @@ from tornado.ioloop import IOLoop
import
shutil
import
StringIO
import
gdriveutils
import
tempfile
import
io
import
hashlib
import
threading
...
...
@@ -1274,12 +1275,13 @@ def on_received_watch_confirmation():
if
response
:
dbpath
=
os
.
path
.
join
(
config
.
config_calibre_dir
,
"metadata.db"
)
if
not
response
[
'deleted'
]
and
response
[
'file'
][
'title'
]
==
'metadata.db'
and
response
[
'file'
][
'md5Checksum'
]
!=
md5
(
dbpath
):
tmpDir
=
tempfile
.
gettempdir
()
app
.
logger
.
info
(
'Database file updated'
)
copyfile
(
dbpath
,
config
.
config_calibre_d
ir
+
"/metadata.db_"
+
str
(
current_milli_time
()))
copyfile
(
dbpath
,
tmpD
ir
+
"/metadata.db_"
+
str
(
current_milli_time
()))
app
.
logger
.
info
(
'Backing up existing and downloading updated metadata.db'
)
gdriveutils
.
downloadFile
(
Gdrive
.
Instance
()
.
drive
,
None
,
"metadata.db"
,
config
.
config_calibre_d
ir
+
"/tmp_metadata.db"
)
gdriveutils
.
downloadFile
(
Gdrive
.
Instance
()
.
drive
,
None
,
"metadata.db"
,
tmpD
ir
+
"/tmp_metadata.db"
)
app
.
logger
.
info
(
'Setting up new DB'
)
os
.
rename
(
config
.
config_calibre_d
ir
+
"/tmp_metadata.db"
,
dbpath
)
os
.
rename
(
tmpD
ir
+
"/tmp_metadata.db"
,
dbpath
)
db
.
setup_db
()
except
Exception
,
e
:
app
.
logger
.
exception
(
e
)
...
...
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