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
a371e40c
Commit
a371e40c
authored
Oct 20, 2019
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github_3/hotfix/epub-import'
Improved cover extraction from epub files
parents
ccc61843
c7d7a759
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
41 deletions
+45
-41
about.py
cps/about.py
+3
-2
converter.py
cps/converter.py
+3
-1
epub.py
cps/epub.py
+20
-13
stats.html
cps/templates/stats.html
+3
-3
messages.mo
cps/translations/de/LC_MESSAGES/messages.mo
+0
-0
messages.po
cps/translations/de/LC_MESSAGES/messages.po
+9
-15
uploader.py
cps/uploader.py
+7
-7
No files found.
cps/about.py
View file @
a371e40c
...
@@ -37,6 +37,7 @@ except ImportError:
...
@@ -37,6 +37,7 @@ except ImportError:
from
flask_login.__about__
import
__version__
as
flask_loginVersion
from
flask_login.__about__
import
__version__
as
flask_loginVersion
try
:
try
:
import
unidecode
import
unidecode
# _() necessary to make babel aware of string for translation
unidecode_version
=
_
(
u'installed'
)
unidecode_version
=
_
(
u'installed'
)
except
ImportError
:
except
ImportError
:
unidecode_version
=
_
(
u'not installed'
)
unidecode_version
=
_
(
u'not installed'
)
...
@@ -62,8 +63,8 @@ _VERSIONS = OrderedDict(
...
@@ -62,8 +63,8 @@ _VERSIONS = OrderedDict(
iso639
=
isoLanguages
.
__version__
,
iso639
=
isoLanguages
.
__version__
,
pytz
=
pytz
.
__version__
,
pytz
=
pytz
.
__version__
,
Unidecode
=
unidecode_version
,
Unidecode
=
unidecode_version
,
Flask_SimpleLDAP
=
_
(
u'installed'
)
if
bool
(
services
.
ldap
)
else
_
(
u'not installed'
)
,
Flask_SimpleLDAP
=
u'installed'
if
bool
(
services
.
ldap
)
else
u'not installed'
,
Goodreads
=
_
(
u'installed'
)
if
bool
(
services
.
goodreads_support
)
else
_
(
u'not installed'
)
,
Goodreads
=
u'installed'
if
bool
(
services
.
goodreads_support
)
else
u'not installed'
,
)
)
_VERSIONS
.
update
(
uploader
.
get_versions
())
_VERSIONS
.
update
(
uploader
.
get_versions
())
...
...
cps/converter.py
View file @
a371e40c
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
from
__future__
import
division
,
print_function
,
unicode_literals
from
__future__
import
division
,
print_function
,
unicode_literals
import
os
import
os
import
re
import
re
from
flask_babel
import
gettext
as
_
from
.
import
config
,
logger
from
.
import
config
,
logger
from
.subproc_wrapper
import
process_wait
from
.subproc_wrapper
import
process_wait
...
@@ -26,7 +27,8 @@ from .subproc_wrapper import process_wait
...
@@ -26,7 +27,8 @@ from .subproc_wrapper import process_wait
log
=
logger
.
create
()
log
=
logger
.
create
()
_NOT_CONFIGURED
=
'not configured'
# _() necessary to make babel aware of string for translation
_NOT_CONFIGURED
=
_
(
'not configured'
)
_NOT_INSTALLED
=
'not installed'
_NOT_INSTALLED
=
'not installed'
_EXECUTION_ERROR
=
'Execution permissions missing'
_EXECUTION_ERROR
=
'Execution permissions missing'
...
...
cps/epub.py
View file @
a371e40c
...
@@ -64,6 +64,11 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -64,6 +64,11 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
for
s
in
[
'title'
,
'description'
,
'creator'
,
'language'
,
'subject'
]:
for
s
in
[
'title'
,
'description'
,
'creator'
,
'language'
,
'subject'
]:
tmp
=
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
)
tmp
=
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
)
if
len
(
tmp
)
>
0
:
if
len
(
tmp
)
>
0
:
if
s
==
'creator'
:
epub_metadata
[
s
]
=
' & '
.
join
(
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
))
elif
s
==
'subject'
:
epub_metadata
[
s
]
=
', '
.
join
(
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
))
else
:
epub_metadata
[
s
]
=
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
)[
0
]
epub_metadata
[
s
]
=
p
.
xpath
(
'dc:
%
s/text()'
%
s
,
namespaces
=
ns
)[
0
]
else
:
else
:
epub_metadata
[
s
]
=
"Unknown"
epub_metadata
[
s
]
=
"Unknown"
...
@@ -109,6 +114,8 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -109,6 +114,8 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
meta_cover
=
tree
.
xpath
(
"/pkg:package/pkg:metadata/pkg:meta[@name='cover']/@content"
,
namespaces
=
ns
)
meta_cover
=
tree
.
xpath
(
"/pkg:package/pkg:metadata/pkg:meta[@name='cover']/@content"
,
namespaces
=
ns
)
if
len
(
meta_cover
)
>
0
:
if
len
(
meta_cover
)
>
0
:
coversection
=
tree
.
xpath
(
"/pkg:package/pkg:manifest/pkg:item[@id='"
+
meta_cover
[
0
]
+
"']/@href"
,
namespaces
=
ns
)
coversection
=
tree
.
xpath
(
"/pkg:package/pkg:manifest/pkg:item[@id='"
+
meta_cover
[
0
]
+
"']/@href"
,
namespaces
=
ns
)
else
:
coversection
=
tree
.
xpath
(
"/pkg:package/pkg:guide/pkg:reference/@href"
,
namespaces
=
ns
)
if
len
(
coversection
)
>
0
:
if
len
(
coversection
)
>
0
:
filetype
=
coversection
[
0
]
.
rsplit
(
'.'
,
1
)[
-
1
]
filetype
=
coversection
[
0
]
.
rsplit
(
'.'
,
1
)[
-
1
]
if
filetype
==
"xhtml"
or
filetype
==
"html"
:
# if cover is (x)html format
if
filetype
==
"xhtml"
or
filetype
==
"html"
:
# if cover is (x)html format
...
...
cps/templates/stats.html
View file @
a371e40c
...
@@ -37,7 +37,7 @@
...
@@ -37,7 +37,7 @@
{% for library,version in versions.items() %}
{% for library,version in versions.items() %}
<tr>
<tr>
<th>
{{library}}
</th>
<th>
{{library}}
</th>
<td>
{{
version
}}
</td>
<td>
{{
_(version)
}}
</td>
</tr>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
...
cps/translations/de/LC_MESSAGES/messages.mo
View file @
a371e40c
No preview for this file type
cps/translations/de/LC_MESSAGES/messages.po
View file @
a371e40c
...
@@ -8,15 +8,16 @@ msgstr ""
...
@@ -8,15 +8,16 @@ msgstr ""
"Project-Id-Version: Calibre-Web\n"
"Project-Id-Version: Calibre-Web\n"
"Report-Msgid-Bugs-To: https://github.com/janeczku/Calibre-Web\n"
"Report-Msgid-Bugs-To: https://github.com/janeczku/Calibre-Web\n"
"POT-Creation-Date: 2019-09-17 18:24+0200\n"
"POT-Creation-Date: 2019-09-17 18:24+0200\n"
"PO-Revision-Date: 2019-
08-06 18:36
+0200\n"
"PO-Revision-Date: 2019-
10-20 15:14
+0200\n"
"Last-Translator: Ozzie Isaacs\n"
"Last-Translator: Ozzie Isaacs\n"
"Language: de\n"
"Language: de\n"
"Language-Team: \n"
"Language-Team: \n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"Plural-Forms: nplurals=2; plural=(n != 1)
;
\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.7.0\n"
"Generated-By: Babel 2.7.0\n"
"X-Generator: Poedit 2.2.4\n"
#: cps/about.py:40 cps/about.py:65 cps/about.py:66 cps/uploader.py:228
#: cps/about.py:40 cps/about.py:65 cps/about.py:66 cps/uploader.py:228
msgid "installed"
msgid "installed"
...
@@ -289,7 +290,7 @@ msgstr "Callback Domain ist nicht verifiziert, bitte Domain in der Google Develo
...
@@ -289,7 +290,7 @@ msgstr "Callback Domain ist nicht verifiziert, bitte Domain in der Google Develo
#: cps/helper.py:79
#: cps/helper.py:79
#, python-format
#, python-format
msgid "%(format)s format not found for book id: %(book)d"
msgid "%(format)s format not found for book id: %(book)d"
msgstr "%(format)s Format für Buch-ID %(book)d nicht gefunden
"
msgstr "%(format)s Format für Buch-ID %(book)d nicht gefunden"
#: cps/helper.py:91
#: cps/helper.py:91
#, python-format
#, python-format
...
@@ -880,7 +881,7 @@ msgstr "Lese ein Buch"
...
@@ -880,7 +881,7 @@ msgstr "Lese ein Buch"
#: cps/web.py:1332
#: cps/web.py:1332
msgid "Error opening eBook. File does not exist or file is not accessible."
msgid "Error opening eBook. File does not exist or file is not accessible."
msgstr "Fehler beim Öffnen des eBooks. Datei existiert nicht oder ist nicht zugänglich.
"
msgstr "Fehler beim Öffnen des eBooks. Datei existiert nicht oder ist nicht zugänglich."
#: cps/worker.py:328
#: cps/worker.py:328
#, python-format
#, python-format
...
@@ -2178,6 +2179,9 @@ msgstr "Benutzer löschen"
...
@@ -2178,6 +2179,9 @@ msgstr "Benutzer löschen"
msgid "Recent Downloads"
msgid "Recent Downloads"
msgstr "Letzte Downloads"
msgstr "Letzte Downloads"
msgid "not configured"
msgstr "Nicht konfiguriert"
#~ msgid "Show sorted books"
#~ msgid "Show sorted books"
#~ msgstr "Zeige Bücher sortiert"
#~ msgstr "Zeige Bücher sortiert"
...
@@ -2274,9 +2278,6 @@ msgstr "Letzte Downloads"
...
@@ -2274,9 +2278,6 @@ msgstr "Letzte Downloads"
#~ msgid "Excecution permissions missing"
#~ msgid "Excecution permissions missing"
#~ msgstr "Ausführungsberechtigung nicht vorhanden"
#~ msgstr "Ausführungsberechtigung nicht vorhanden"
#~ msgid "not configured"
#~ msgstr "Nicht konfiguriert"
#~ msgid "Error excecuting UnRar"
#~ msgid "Error excecuting UnRar"
#~ msgstr "Fehler bei der Ausführung von UnRar"
#~ msgstr "Fehler bei der Ausführung von UnRar"
...
@@ -2307,12 +2308,5 @@ msgstr "Letzte Downloads"
...
@@ -2307,12 +2308,5 @@ msgstr "Letzte Downloads"
#~ msgid "Google OAuth Client Secret"
#~ msgid "Google OAuth Client Secret"
#~ msgstr "Google OAuth Client-Secret"
#~ msgstr "Google OAuth Client-Secret"
#~ msgid "Installed"
#~ msgstr ""
#~ msgid "Not installed"
#~ msgstr ""
#~ msgid "Use"
#~ msgid "Use"
#~ msgstr "Benutzen"
#~ msgstr "Benutzen"
cps/uploader.py
View file @
a371e40c
...
@@ -210,24 +210,24 @@ def get_versions():
...
@@ -210,24 +210,24 @@ def get_versions():
IVersion
=
ImageVersion
.
MAGICK_VERSION
IVersion
=
ImageVersion
.
MAGICK_VERSION
WVersion
=
ImageVersion
.
VERSION
WVersion
=
ImageVersion
.
VERSION
else
:
else
:
IVersion
=
_
(
u'not installed'
)
IVersion
=
u'not installed'
WVersion
=
_
(
u'not installed'
)
WVersion
=
u'not installed'
if
use_pdf_meta
:
if
use_pdf_meta
:
PVersion
=
'v'
+
PyPdfVersion
PVersion
=
'v'
+
PyPdfVersion
else
:
else
:
PVersion
=
_
(
u'not installed'
)
PVersion
=
u'not installed'
if
lxmlversion
:
if
lxmlversion
:
XVersion
=
'v'
+
'.'
.
join
(
map
(
str
,
lxmlversion
))
XVersion
=
'v'
+
'.'
.
join
(
map
(
str
,
lxmlversion
))
else
:
else
:
XVersion
=
_
(
u'not installed'
)
XVersion
=
u'not installed'
if
use_PIL
:
if
use_PIL
:
PILVersion
=
'v'
+
PILversion
PILVersion
=
'v'
+
PILversion
else
:
else
:
PILVersion
=
_
(
u'not installed'
)
PILVersion
=
u'not installed'
if
comic
.
use_comic_meta
:
if
comic
.
use_comic_meta
:
ComicVersion
=
_
(
u'installed'
)
ComicVersion
=
u'installed'
else
:
else
:
ComicVersion
=
_
(
u'not installed'
)
ComicVersion
=
u'not installed'
return
{
'Image Magick'
:
IVersion
,
return
{
'Image Magick'
:
IVersion
,
'PyPdf'
:
PVersion
,
'PyPdf'
:
PVersion
,
'lxml'
:
XVersion
,
'lxml'
:
XVersion
,
...
...
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