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
70c666c3
Commit
70c666c3
authored
May 24, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload book without reload complete library
parent
46197d82
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
editbooks.py
cps/editbooks.py
+7
-6
No files found.
cps/editbooks.py
View file @
70c666c3
...
...
@@ -816,6 +816,7 @@ def upload():
calibre_db
.
session
.
add
(
db_book
)
calibre_db
.
session
.
flush
()
book_id
=
db_book
.
id
title
=
db_book
.
title
error
=
helper
.
update_dir_stucture
(
book_id
,
config
.
config_calibre_dir
,
input_authors
[
0
])
...
...
@@ -833,24 +834,24 @@ def upload():
# save data to database, reread data
calibre_db
.
session
.
commit
()
calibre_db
.
setup_db
(
config
,
ub
.
app_DB_path
)
#
calibre_db.setup_db(config, ub.app_DB_path)
# Reread book. It's important not to filter the result, as it could have language which hide it from
# current users view (tags are not stored/extracted from metadata and could also be limited)
book
=
calibre_db
.
get_book
(
book_id
)
#
book = calibre_db.get_book(book_id)
if
config
.
config_use_google_drive
:
gdriveutils
.
updateGdriveCalibreFromLocal
()
if
error
:
flash
(
error
,
category
=
"error"
)
uploadText
=
_
(
u"File
%(file)
s uploaded"
,
file
=
book
.
title
)
uploadText
=
_
(
u"File
%(file)
s uploaded"
,
file
=
title
)
worker
.
add_upload
(
current_user
.
nickname
,
"<a href=
\"
"
+
url_for
(
'web.show_book'
,
book_id
=
book
.
id
)
+
"
\"
>"
+
uploadText
+
"</a>"
)
"<a href=
\"
"
+
url_for
(
'web.show_book'
,
book_id
=
book
_
id
)
+
"
\"
>"
+
uploadText
+
"</a>"
)
if
len
(
request
.
files
.
getlist
(
"btn-upload"
))
<
2
:
if
current_user
.
role_edit
()
or
current_user
.
role_admin
():
resp
=
{
"location"
:
url_for
(
'editbook.edit_book'
,
book_id
=
book
.
id
)}
resp
=
{
"location"
:
url_for
(
'editbook.edit_book'
,
book_id
=
book
_
id
)}
return
Response
(
json
.
dumps
(
resp
),
mimetype
=
'application/json'
)
else
:
resp
=
{
"location"
:
url_for
(
'web.show_book'
,
book_id
=
book
.
id
)}
resp
=
{
"location"
:
url_for
(
'web.show_book'
,
book_id
=
book
_
id
)}
return
Response
(
json
.
dumps
(
resp
),
mimetype
=
'application/json'
)
except
OperationalError
as
e
:
calibre_db
.
session
.
rollback
()
...
...
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