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
e66068d6
Unverified
Commit
e66068d6
authored
Dec 20, 2017
by
Andriy Zasypkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
should fix testing error
parent
6b6a457a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
web.py
cps/web.py
+6
-6
No files found.
cps/web.py
View file @
e66068d6
...
...
@@ -31,10 +31,10 @@ except ImportError:
rar_support
=
False
try
:
from
natsort
import
natsorted
as
sort
ed
from
natsort
import
natsorted
as
sort
except
ImportError
:
pass
# Just use regular sort then
# may cause issues with badly named pages in cbz/cbr files
sort
=
sorted
# Just use regular sort then
# may cause issues with badly named pages in cbz/cbr files
import
mimetypes
import
logging
...
...
@@ -937,7 +937,7 @@ def get_comic_book(book_id, book_format, page):
rarfile
.
UNRAR_TOOL
=
config
.
config_rarfile_location
try
:
rf
=
rarfile
.
RarFile
(
cbr_file
)
rarNames
=
sort
ed
(
rf
.
namelist
())
rarNames
=
sort
(
rf
.
namelist
())
b64
=
codecs
.
encode
(
rf
.
read
(
rarNames
[
page
]),
'base64'
)
.
decode
()
extractedfile
=
"data:image/png;base64,"
+
b64
fileData
=
{
"name"
:
rarNames
[
page
],
"page"
:
page
,
"last"
:
rarNames
.
__len__
()
-
1
,
"content"
:
extractedfile
}
...
...
@@ -951,7 +951,7 @@ def get_comic_book(book_id, book_format, page):
return
""
,
204
if
book_format
in
(
"cbz"
,
"zip"
):
zf
=
zipfile
.
ZipFile
(
cbr_file
)
zipNames
=
sort
ed
(
zf
.
namelist
())
zipNames
=
sort
(
zf
.
namelist
())
if
sys
.
version_info
.
major
>=
3
:
b64
=
codecs
.
encode
(
zf
.
read
(
zipNames
[
page
]),
'base64'
)
.
decode
()
else
:
...
...
@@ -961,7 +961,7 @@ def get_comic_book(book_id, book_format, page):
if
book_format
in
(
"cbt"
,
"tar"
):
tf
=
tarfile
.
TarFile
(
cbr_file
)
tarNames
=
sort
ed
(
tf
.
getnames
())
tarNames
=
sort
(
tf
.
getnames
())
if
sys
.
version_info
.
major
>=
3
:
b64
=
codecs
.
encode
(
tf
.
extractfile
(
tarNames
[
page
])
.
read
(),
'base64'
)
.
decode
()
else
:
...
...
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