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
40cc25de
Commit
40cc25de
authored
Oct 03, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'bbb/621'
Fixes after testing
parents
5a2ed58d
a7386ecb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
helper.py
cps/helper.py
+5
-5
book_edit.html
cps/templates/book_edit.html
+3
-3
detail.html
cps/templates/detail.html
+1
-1
web.py
cps/web.py
+10
-6
No files found.
cps/helper.py
View file @
40cc25de
...
...
@@ -236,8 +236,8 @@ def update_dir_structure_file(book_id, calibrepath):
path
=
new_title_path
localbook
.
path
=
localbook
.
path
.
split
(
'/'
)[
0
]
+
'/'
+
new_titledir
except
OSError
as
ex
:
web
.
app
.
logger
.
error
(
"Rename title from: "
+
path
+
" to "
+
new_title_path
)
web
.
app
.
logger
.
error
(
ex
,
exc_info
=
True
)
web
.
app
.
logger
.
error
(
"Rename title from: "
+
path
+
" to "
+
new_title_path
+
": "
+
str
(
ex
)
)
web
.
app
.
logger
.
debug
(
ex
,
exc_info
=
True
)
return
_
(
"Rename title from: '
%(src)
s' to '
%(dest)
s' failed with error:
%(error)
s"
,
src
=
path
,
dest
=
new_title_path
,
error
=
str
(
ex
))
if
authordir
!=
new_authordir
:
try
:
...
...
@@ -245,9 +245,9 @@ def update_dir_structure_file(book_id, calibrepath):
os
.
renames
(
path
,
new_author_path
)
localbook
.
path
=
new_authordir
+
'/'
+
localbook
.
path
.
split
(
'/'
)[
1
]
except
OSError
as
ex
:
web
.
app
.
logger
.
error
(
"Rename author from: "
+
path
+
" to "
+
new_author_path
)
web
.
app
.
logger
.
error
(
ex
,
exc_info
=
True
)
return
_
(
"Rename author from: '
%(src)
s' to '
%(dest)
s' failed with error:
%(error)
s"
,
src
=
path
,
dest
=
new_
title
_path
,
error
=
str
(
ex
))
web
.
app
.
logger
.
error
(
"Rename author from: "
+
path
+
" to "
+
new_author_path
+
": "
+
str
(
ex
)
)
web
.
app
.
logger
.
debug
(
ex
,
exc_info
=
True
)
return
_
(
"Rename author from: '
%(src)
s' to '
%(dest)
s' failed with error:
%(error)
s"
,
src
=
path
,
dest
=
new_
author
_path
,
error
=
str
(
ex
))
return
False
...
...
cps/templates/book_edit.html
View file @
40cc25de
...
...
@@ -6,9 +6,9 @@
<div
class=
"col-sm-3 col-lg-3 col-xs-12"
>
<div
class=
"cover"
>
{% if book.has_cover %}
<img
src=
"{{ url_for('get_cover', cover_path=book.path.replace('\\','/')) }}"
/>
<img
src=
"{{ url_for('get_cover', cover_path=book.path.replace('\\','/')) }}"
alt=
"{{ book.title }}"
/>
{% else %}
<img
src=
"{{ url_for('static', filename='generic_cover.jpg') }}"
/>
<img
src=
"{{ url_for('static', filename='generic_cover.jpg') }}"
alt=
"{{ book.title }}"
/>
{% endif %}
</div>
{% if g.user.role_delete_books() %}
...
...
@@ -174,7 +174,7 @@
</label>
</div>
<a
href=
"#"
id=
"get_meta"
class=
"btn btn-default"
data-toggle=
"modal"
data-target=
"#metaModal"
>
{{_('Get metadata')}}
</a>
<button
type=
"submit"
class=
"btn btn-default"
>
{{_('Submit')}}
</button>
<button
type=
"submit"
id=
"submit"
class=
"btn btn-default"
>
{{_('Submit')}}
</button>
<a
href=
"{{ url_for('show_book', book_id=book.id) }}"
class=
"btn btn-default"
>
{{_('Back')}}
</a>
</div>
</form>
...
...
cps/templates/detail.html
View file @
40cc25de
...
...
@@ -250,7 +250,7 @@
{% if g.user.role_edit() %}
<div
class=
"btn-toolbar"
role=
"toolbar"
>
<div
class=
"btn-group"
role=
"group"
aria-label=
"Edit/Delete book"
>
<a
href=
"{{ url_for('edit_book', book_id=entry.id) }}"
class=
"btn btn-sm btn-warning"
role=
"button"
><span
class=
"glyphicon glyphicon-edit"
></span>
{{_('Edit metadata')}}
</a>
<a
href=
"{{ url_for('edit_book', book_id=entry.id) }}"
class=
"btn btn-sm btn-warning"
id=
"edit_book"
role=
"button"
><span
class=
"glyphicon glyphicon-edit"
></span>
{{_('Edit metadata')}}
</a>
</div>
</div>
{% endif %}
...
...
cps/web.py
View file @
40cc25de
...
...
@@ -172,7 +172,12 @@ cache_buster.init_cache_busting(app)
formatter
=
logging
.
Formatter
(
"[
%(asctime)
s] {
%(pathname)
s:
%(lineno)
d}
%(levelname)
s -
%(message)
s"
)
file_handler
=
RotatingFileHandler
(
config
.
get_config_logfile
(),
maxBytes
=
50000
,
backupCount
=
2
)
try
:
file_handler
=
RotatingFileHandler
(
config
.
get_config_logfile
(),
maxBytes
=
50000
,
backupCount
=
2
)
except
IOError
:
file_handler
=
RotatingFileHandler
(
os
.
path
.
join
(
config
.
get_main_dir
,
"calibre-web.log"
),
maxBytes
=
50000
,
backupCount
=
2
)
# ToDo: reset logfile value in config class
file_handler
.
setFormatter
(
formatter
)
app
.
logger
.
addHandler
(
file_handler
)
app
.
logger
.
setLevel
(
config
.
config_log_level
)
...
...
@@ -207,7 +212,8 @@ def get_locale():
# if a user is logged in, use the locale from the user settings
user
=
getattr
(
g
,
'user'
,
None
)
if
user
is
not
None
and
hasattr
(
user
,
"locale"
):
return
user
.
locale
if
user
.
nickname
!=
'Guest'
:
# if the account is the guest account bypass the config lang settings
return
user
.
locale
translations
=
[
item
.
language
for
item
in
babel
.
list_translations
()]
+
[
'en'
]
preferred
=
[
x
.
replace
(
'-'
,
'_'
)
for
x
in
request
.
accept_languages
.
values
()]
return
negotiate_locale
(
preferred
,
translations
)
...
...
@@ -3573,10 +3579,10 @@ def edit_book(book_id):
# Update book
edited_books_id
=
None
#handle book title
if
book
.
title
!=
to_save
[
"book_title"
]:
if
book
.
title
!=
to_save
[
"book_title"
]
.
rstrip
()
.
strip
()
:
if
to_save
[
"book_title"
]
==
''
:
to_save
[
"book_title"
]
=
_
(
u'unknown'
)
book
.
title
=
to_save
[
"book_title"
]
book
.
title
=
to_save
[
"book_title"
]
.
rstrip
()
.
strip
()
edited_books_id
=
book
.
id
# handle author(s)
...
...
@@ -3601,8 +3607,6 @@ def edit_book(book_id):
error
=
False
if
edited_books_id
:
error
=
helper
.
update_dir_stucture
(
edited_books_id
,
config
.
config_calibre_dir
)
if
error
:
# stop on error
flash
(
error
,
category
=
"error"
)
if
not
error
:
if
to_save
[
"cover_url"
]:
...
...
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