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
74286286
Commit
74286286
authored
Jul 30, 2017
by
Carlos Clavero
Committed by
GitHub
Jul 30, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Epub series metadata"
parent
063267d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
32 deletions
+6
-32
epub.py
cps/epub.py
+2
-14
web.py
cps/web.py
+4
-18
No files found.
cps/epub.py
View file @
74286286
...
@@ -68,18 +68,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -68,18 +68,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
else
:
else
:
epub_metadata
[
'language'
]
=
""
epub_metadata
[
'language'
]
=
""
series
=
tree
.
xpath
(
"/pkg:package/pkg:metadata/pkg:meta[@name='calibre:series']/@content"
,
namespaces
=
ns
)
if
len
(
series
)
>
0
:
epub_metadata
[
'series'
]
=
series
[
0
]
else
:
epub_metadata
[
'series'
]
=
''
series_id
=
tree
.
xpath
(
"/pkg:package/pkg:metadata/pkg:meta[@name='calibre:series_index']/@content"
,
namespaces
=
ns
)
if
len
(
series_id
)
>
0
:
epub_metadata
[
'series_id'
]
=
series_id
[
0
]
else
:
epub_metadata
[
'series_id'
]
=
'1'
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
)
coverfile
=
None
coverfile
=
None
if
len
(
coversection
)
>
0
:
if
len
(
coversection
)
>
0
:
...
@@ -114,6 +102,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
...
@@ -114,6 +102,6 @@ def get_epub_info(tmp_file_path, original_file_name, original_file_extension):
cover
=
coverfile
,
cover
=
coverfile
,
description
=
epub_metadata
[
'description'
],
description
=
epub_metadata
[
'description'
],
tags
=
""
,
tags
=
""
,
series
=
epub_metadata
[
'series'
]
.
encode
(
'utf-8'
)
.
decode
(
'utf-8'
)
,
series
=
""
,
series_id
=
epub_metadata
[
'series_id'
]
.
encode
(
'utf-8'
)
.
decode
(
'utf-8'
)
,
series_id
=
""
,
languages
=
epub_metadata
[
'language'
])
languages
=
epub_metadata
[
'language'
])
cps/web.py
View file @
74286286
...
@@ -2907,17 +2907,13 @@ def upload():
...
@@ -2907,17 +2907,13 @@ def upload():
title
=
meta
.
title
title
=
meta
.
title
author
=
meta
.
author
author
=
meta
.
author
series
=
meta
.
series
series_index
=
meta
.
series_id
title_dir
=
helper
.
get_valid_filename
(
title
,
False
)
title_dir
=
helper
.
get_valid_filename
(
title
,
False
)
author_dir
=
helper
.
get_valid_filename
(
author
,
False
)
author_dir
=
helper
.
get_valid_filename
(
author
,
False
)
data_name
=
title_dir
data_name
=
title_dir
filepath
=
config
.
config_calibre_dir
+
os
.
sep
+
author_dir
+
os
.
sep
+
title_dir
filepath
=
config
.
config_calibre_dir
+
os
.
sep
+
author_dir
+
os
.
sep
+
title_dir
saved_filename
=
filepath
+
os
.
sep
+
data_name
+
meta
.
extension
saved_filename
=
filepath
+
os
.
sep
+
data_name
+
meta
.
extension
if
series_index
==
''
:
series_index
=
1
if
not
os
.
path
.
exists
(
filepath
):
if
not
os
.
path
.
exists
(
filepath
):
try
:
try
:
os
.
makedirs
(
filepath
)
os
.
makedirs
(
filepath
)
...
@@ -2950,14 +2946,6 @@ def upload():
...
@@ -2950,14 +2946,6 @@ def upload():
db_author
=
db
.
Authors
(
author
,
helper
.
get_sorted_author
(
author
),
""
)
db_author
=
db
.
Authors
(
author
,
helper
.
get_sorted_author
(
author
),
""
)
db
.
session
.
add
(
db_author
)
db
.
session
.
add
(
db_author
)
db_series
=
None
is_series
=
db
.
session
.
query
(
db
.
Series
)
.
filter
(
db
.
Series
.
name
==
series
)
.
first
()
if
is_series
:
db_series
=
is_series
elif
series
!=
''
:
db_series
=
db
.
Series
(
series
,
""
)
db
.
session
.
add
(
db_series
)
# add language actually one value in list
# add language actually one value in list
input_language
=
meta
.
languages
input_language
=
meta
.
languages
db_language
=
None
db_language
=
None
...
@@ -2971,11 +2959,9 @@ def upload():
...
@@ -2971,11 +2959,9 @@ def upload():
db
.
session
.
add
(
db_language
)
db
.
session
.
add
(
db_language
)
# combine path and normalize path from windows systems
# combine path and normalize path from windows systems
path
=
os
.
path
.
join
(
author_dir
,
title_dir
)
.
replace
(
'
\\
'
,
'/'
)
path
=
os
.
path
.
join
(
author_dir
,
title_dir
)
.
replace
(
'
\\
'
,
'/'
)
db_book
=
db
.
Books
(
title
,
""
,
db_author
.
sort
,
datetime
.
datetime
.
now
(),
datetime
.
datetime
(
101
,
1
,
1
),
db_book
=
db
.
Books
(
title
,
""
,
db_author
.
sort
,
datetime
.
datetime
.
now
(),
datetime
.
datetime
(
101
,
1
,
1
),
1
,
series_index
,
datetime
.
datetime
.
now
(),
path
,
has_cover
,
db_author
,
[],
db_language
)
datetime
.
datetime
.
now
(),
path
,
has_cover
,
db_author
,
[],
db_language
)
db_book
.
authors
.
append
(
db_author
)
db_book
.
authors
.
append
(
db_author
)
if
db_series
:
db_book
.
series
.
append
(
db_series
)
if
db_language
is
not
None
:
if
db_language
is
not
None
:
db_book
.
languages
.
append
(
db_language
)
db_book
.
languages
.
append
(
db_language
)
db_data
=
db
.
Data
(
db_book
,
meta
.
extension
.
upper
()[
1
:],
file_size
,
data_name
)
db_data
=
db
.
Data
(
db_book
,
meta
.
extension
.
upper
()[
1
:],
file_size
,
data_name
)
...
@@ -3010,4 +2996,4 @@ def start_gevent():
...
@@ -3010,4 +2996,4 @@ def start_gevent():
from
gevent.wsgi
import
WSGIServer
from
gevent.wsgi
import
WSGIServer
global
gevent_server
global
gevent_server
gevent_server
=
WSGIServer
((
''
,
ub
.
config
.
config_port
),
app
)
gevent_server
=
WSGIServer
((
''
,
ub
.
config
.
config_port
),
app
)
gevent_server
.
serve_forever
()
gevent_server
.
serve_forever
()
\ No newline at end of file
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