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
13b4ae4c
Commit
13b4ae4c
authored
Mar 02, 2017
by
林檎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more error adaptive
parent
879510da
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
epub.py
cps/epub.py
+10
-7
No files found.
cps/epub.py
View file @
13b4ae4c
...
@@ -48,6 +48,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -48,6 +48,7 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
else
:
else
:
epub_metadata
[
s
]
=
"Unknown"
epub_metadata
[
s
]
=
"Unknown"
#detect lang need futher modification in web.py /upload
#detect lang need futher modification in web.py /upload
try
:
#maybe dc:language isn't present, less possible but possible
lang
=
p
.
xpath
(
'dc:language/text()'
,
namespaces
=
ns
)[
0
]
lang
=
p
.
xpath
(
'dc:language/text()'
,
namespaces
=
ns
)[
0
]
lang
=
lang
.
split
(
'-'
,
1
)[
0
]
lang
=
lang
.
split
(
'-'
,
1
)[
0
]
if
len
(
lang
)
==
2
:
if
len
(
lang
)
==
2
:
...
@@ -56,6 +57,8 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -56,6 +57,8 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
epub_metadata
[
'languages'
]
=
isoLanguages
.
get
(
part3
=
lang
)
.
name
epub_metadata
[
'languages'
]
=
isoLanguages
.
get
(
part3
=
lang
)
.
name
else
:
else
:
epub_metadata
[
'languages'
]
=
""
epub_metadata
[
'languages'
]
=
""
except
:
epub_metadata
[
'languages'
]
=
""
coversection
=
tree
.
xpath
(
"/pkg:package/pkg:manifest/pkg:item[@id='cover-image']/@href"
,
namespaces
=
ns
)
coversection
=
tree
.
xpath
(
"/pkg:package/pkg:manifest/pkg:item[@id='cover-image']/@href"
,
namespaces
=
ns
)
if
len
(
coversection
)
>
0
:
if
len
(
coversection
)
>
0
:
...
...
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