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
de58d0a4
Commit
de58d0a4
authored
Mar 01, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'metadata/Develop' into Develop
Update logger for updater
parents
246d7673
54a006a4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
14 deletions
+21
-14
__init__.py
cps/__init__.py
+2
-6
admin.py
cps/admin.py
+1
-1
style.css
cps/static/css/style.css
+10
-0
book_edit.html
cps/templates/book_edit.html
+1
-1
uploader.py
cps/uploader.py
+7
-6
No files found.
cps/__init__.py
View file @
de58d0a4
...
...
@@ -25,9 +25,6 @@ except ImportError:
import
pickle
as
cPickle
mimetypes
.
init
()
mimetypes
.
add_type
(
'application/xhtml+xml'
,
'.xhtml'
)
mimetypes
.
add_type
(
'application/epub+zip'
,
'.epub'
)
...
...
@@ -56,7 +53,6 @@ lm.anonymous_user = ub.Anonymous
ub
.
init_db
()
config
=
Config
()
import
db
with
open
(
os
.
path
.
join
(
config
.
get_main_dir
,
'cps/translations/iso639.pickle'
),
'rb'
)
as
f
:
...
...
@@ -90,8 +86,8 @@ def create_app():
app
.
logger
.
setLevel
(
config
.
config_log_level
)
app
.
logger
.
info
(
'Starting Calibre Web...'
)
logging
.
getLogger
(
"book_formats
"
)
.
addHandler
(
file_handler
)
logging
.
getLogger
(
"book_formats
"
)
.
setLevel
(
config
.
config_log_level
)
# logging.getLogger("uploader
").addHandler(file_handler)
# logging.getLogger("uploader
").setLevel(config.config_log_level)
Principal
(
app
)
lm
.
init_app
(
app
)
app
.
secret_key
=
os
.
getenv
(
'SECRET_KEY'
,
'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
)
...
...
cps/admin.py
View file @
de58d0a4
...
...
@@ -494,7 +494,7 @@ def configuration_helper(origin):
flash
(
_
(
u"Calibre-Web configuration updated"
),
category
=
"success"
)
config
.
loadSettings
()
app
.
logger
.
setLevel
(
config
.
config_log_level
)
logging
.
getLogger
(
"uploader"
)
.
setLevel
(
config
.
config_log_level
)
#
logging.getLogger("uploader").setLevel(config.config_log_level)
except
Exception
as
e
:
flash
(
e
,
category
=
"error"
)
return
render_title_template
(
"config_edit.html"
,
content
=
config
,
origin
=
origin
,
...
...
cps/static/css/style.css
View file @
de58d0a4
...
...
@@ -103,6 +103,16 @@ input.pill:not(:checked) + label .glyphicon {
.tags_click
,
.serie_click
,
.language_click
{
margin-right
:
5px
;}
#meta-info
{
height
:
600px
;
overflow-y
:
scroll
;
}
.media-list
{
padding-right
:
15px
;
}
.media-body
p
{
text-align
:
justify
;
}
#meta-info
img
{
max-height
:
150px
;
max-width
:
100px
;
cursor
:
pointer
;
}
.padded-bottom
{
margin-bottom
:
15px
;
}
...
...
cps/templates/book_edit.html
View file @
de58d0a4
...
...
@@ -219,7 +219,7 @@
</span>
</div>
</form>
<div
>
{{_('Click the cover to load metadata to the form')}}
</div>
<div
class=
"text-center"
><strong>
{{_('Click the cover to load metadata to the form')}}
</strong>
</div>
</div>
<div
class=
"modal-body"
>
<div
class=
"text-center padded-bottom"
>
...
...
cps/uploader.py
View file @
de58d0a4
...
...
@@ -25,12 +25,13 @@ import logging
import
os
from
flask_babel
import
gettext
as
_
import
comic
from
cps
import
app
try
:
from
lxml.etree
import
LXML_VERSION
as
lxmlversion
except
ImportError
:
lxmlversion
=
None
logger
=
logging
.
getLogger
(
"book_formats
"
)
# logger = logging.getLogger("uploader
")
try
:
from
wand.image
import
Image
...
...
@@ -38,28 +39,28 @@ try:
from
wand.exceptions
import
PolicyError
use_generic_pdf_cover
=
False
except
(
ImportError
,
RuntimeError
)
as
e
:
logger
.
warning
(
'cannot import Image, generating pdf covers for pdf uploads will not work:
%
s'
,
e
)
app
.
logger
.
warning
(
'cannot import Image, generating pdf covers for pdf uploads will not work:
%
s'
,
e
)
use_generic_pdf_cover
=
True
try
:
from
PyPDF2
import
PdfFileReader
from
PyPDF2
import
__version__
as
PyPdfVersion
use_pdf_meta
=
True
except
ImportError
as
e
:
logger
.
warning
(
'cannot import PyPDF2, extracting pdf metadata will not work:
%
s'
,
e
)
app
.
logger
.
warning
(
'cannot import PyPDF2, extracting pdf metadata will not work:
%
s'
,
e
)
use_pdf_meta
=
False
try
:
import
epub
use_epub_meta
=
True
except
ImportError
as
e
:
logger
.
warning
(
'cannot import epub, extracting epub metadata will not work:
%
s'
,
e
)
app
.
logger
.
warning
(
'cannot import epub, extracting epub metadata will not work:
%
s'
,
e
)
use_epub_meta
=
False
try
:
import
fb2
use_fb2_meta
=
True
except
ImportError
as
e
:
logger
.
warning
(
'cannot import fb2, extracting fb2 metadata will not work:
%
s'
,
e
)
app
.
logger
.
warning
(
'cannot import fb2, extracting fb2 metadata will not work:
%
s'
,
e
)
use_fb2_meta
=
False
__author__
=
'lemmsh'
...
...
@@ -84,7 +85,7 @@ def process(tmp_file_path, original_file_name, original_file_extension):
meta
=
comic
.
get_comic_info
(
tmp_file_path
,
original_file_name
,
original_file_extension
)
except
Exception
as
ex
:
logger
.
warning
(
'cannot parse metadata, using default:
%
s'
,
ex
)
app
.
logger
.
warning
(
'cannot parse metadata, using default:
%
s'
,
ex
)
if
meta
and
meta
.
title
.
strip
()
and
meta
.
author
.
strip
():
return
meta
...
...
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