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
a4190f39
Commit
a4190f39
authored
Sep 02, 2018
by
OzzieIsaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #577
parent
4dd6c55c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
22 deletions
+24
-22
converter.py
cps/converter.py
+1
-1
worker.py
cps/worker.py
+23
-21
No files found.
cps/converter.py
View file @
a4190f39
...
...
@@ -32,7 +32,7 @@ def versionCalibre():
for
lines
in
p
.
stdout
.
readlines
():
if
isinstance
(
lines
,
bytes
):
lines
=
lines
.
decode
(
'utf-8'
)
if
re
.
search
(
'.*
\
(calibre'
,
lines
):
if
re
.
search
(
'
ebook-convert
.*
\
(calibre'
,
lines
):
versions
=
lines
except
Exception
:
versions
=
_
(
u'Excecution permissions missing'
)
...
...
cps/worker.py
View file @
a4190f39
...
...
@@ -303,27 +303,29 @@ class WorkerThread(threading.Thread):
if
(
check
<
2
and
web
.
ub
.
config
.
config_ebookconverter
==
1
)
or
\
(
check
==
0
and
web
.
ub
.
config
.
config_ebookconverter
==
2
):
cur_book
=
web
.
db
.
session
.
query
(
web
.
db
.
Books
)
.
filter
(
web
.
db
.
Books
.
id
==
bookid
)
.
first
()
new_format
=
web
.
db
.
Data
(
name
=
cur_book
.
data
[
0
]
.
name
,
book_format
=
self
.
queue
[
self
.
current
][
'settings'
][
'new_book_format'
],
book
=
bookid
,
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
format_new_ext
))
cur_book
.
data
.
append
(
new_format
)
web
.
db
.
session
.
commit
()
self
.
queue
[
self
.
current
][
'path'
]
=
cur_book
.
path
self
.
queue
[
self
.
current
][
'title'
]
=
cur_book
.
title
if
web
.
ub
.
config
.
config_use_google_drive
:
os
.
remove
(
file_path
+
format_old_ext
)
self
.
queue
[
self
.
current
][
'status'
]
=
STAT_FINISH_SUCCESS
self
.
UIqueue
[
self
.
current
][
'status'
]
=
_
(
'Finished'
)
self
.
UIqueue
[
self
.
current
][
'progress'
]
=
"100
%
"
self
.
UIqueue
[
self
.
current
][
'runtime'
]
=
self
.
_formatRuntime
(
datetime
.
now
()
-
self
.
queue
[
self
.
current
][
'starttime'
])
return
file_path
+
format_new_ext
else
:
web
.
app
.
logger
.
info
(
"ebook converter failed with error while converting book"
)
if
not
error_message
:
error_message
=
'Ebook converter failed with unknown error'
self
.
_handleError
(
error_message
)
return
if
os
.
path
.
isfile
(
file_path
+
format_new_ext
):
new_format
=
web
.
db
.
Data
(
name
=
cur_book
.
data
[
0
]
.
name
,
book_format
=
self
.
queue
[
self
.
current
][
'settings'
][
'new_book_format'
],
book
=
bookid
,
uncompressed_size
=
os
.
path
.
getsize
(
file_path
+
format_new_ext
))
cur_book
.
data
.
append
(
new_format
)
web
.
db
.
session
.
commit
()
self
.
queue
[
self
.
current
][
'path'
]
=
cur_book
.
path
self
.
queue
[
self
.
current
][
'title'
]
=
cur_book
.
title
if
web
.
ub
.
config
.
config_use_google_drive
:
os
.
remove
(
file_path
+
format_old_ext
)
self
.
queue
[
self
.
current
][
'status'
]
=
STAT_FINISH_SUCCESS
self
.
UIqueue
[
self
.
current
][
'status'
]
=
_
(
'Finished'
)
self
.
UIqueue
[
self
.
current
][
'progress'
]
=
"100
%
"
self
.
UIqueue
[
self
.
current
][
'runtime'
]
=
self
.
_formatRuntime
(
datetime
.
now
()
-
self
.
queue
[
self
.
current
][
'starttime'
])
return
file_path
+
format_new_ext
else
:
error_message
=
format_new_ext
.
upper
()
+
' format not found on disk'
web
.
app
.
logger
.
info
(
"ebook converter failed with error while converting book"
)
if
not
error_message
:
error_message
=
'Ebook converter failed with unknown error'
self
.
_handleError
(
error_message
)
return
def
add_convert
(
self
,
file_path
,
bookid
,
user_name
,
typ
,
settings
,
kindle_mail
=
None
):
...
...
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