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
e3f4f24c
Commit
e3f4f24c
authored
Oct 04, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for failed email and conversions with gdrive
parent
eb37e3a5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
7 deletions
+8
-7
worker.py
cps/services/worker.py
+1
-1
convert.py
cps/tasks/convert.py
+3
-3
mail.py
cps/tasks/mail.py
+4
-3
No files found.
cps/services/worker.py
View file @
e3f4f24c
...
@@ -210,7 +210,7 @@ class CalibreTask:
...
@@ -210,7 +210,7 @@ class CalibreTask:
self
.
_progress
=
x
self
.
_progress
=
x
def
_handleError
(
self
,
error_message
):
def
_handleError
(
self
,
error_message
):
log
.
e
rror
(
error_message
)
log
.
e
xception
(
error_message
)
self
.
stat
=
STAT_FAIL
self
.
stat
=
STAT_FAIL
self
.
progress
=
1
self
.
progress
=
1
self
.
error
=
error_message
self
.
error
=
error_message
...
...
cps/tasks/convert.py
View file @
e3f4f24c
...
@@ -51,6 +51,8 @@ class TaskConvert(CalibreTask):
...
@@ -51,6 +51,8 @@ class TaskConvert(CalibreTask):
return
error_message
return
error_message
filename
=
self
.
_convert_ebook_format
()
filename
=
self
.
_convert_ebook_format
()
if
config
.
config_use_google_drive
:
os
.
remove
(
self
.
file_path
+
u'.'
+
self
.
settings
[
'old_book_format'
]
.
lower
())
if
filename
:
if
filename
:
if
config
.
config_use_google_drive
:
if
config
.
config_use_google_drive
:
...
@@ -117,9 +119,7 @@ class TaskConvert(CalibreTask):
...
@@ -117,9 +119,7 @@ class TaskConvert(CalibreTask):
return
return
self
.
results
[
'path'
]
=
cur_book
.
path
self
.
results
[
'path'
]
=
cur_book
.
path
self
.
results
[
'title'
]
=
cur_book
.
title
self
.
results
[
'title'
]
=
cur_book
.
title
if
config
.
config_use_google_drive
:
if
not
config
.
config_use_google_drive
:
os
.
remove
(
file_path
+
format_old_ext
)
else
:
self
.
_handleSuccess
()
self
.
_handleSuccess
()
return
os
.
path
.
basename
(
file_path
+
format_new_ext
)
return
os
.
path
.
basename
(
file_path
+
format_new_ext
)
else
:
else
:
...
...
cps/tasks/mail.py
View file @
e3f4f24c
...
@@ -169,7 +169,7 @@ class TaskEmail(CalibreTask):
...
@@ -169,7 +169,7 @@ class TaskEmail(CalibreTask):
except
(
MemoryError
)
as
e
:
except
(
MemoryError
)
as
e
:
log
.
exception
(
e
)
log
.
exception
(
e
)
self
.
_handleError
(
u'MemoryError sending email: '
+
str
(
e
))
self
.
_handleError
(
u'MemoryError sending email: '
+
str
(
e
))
return
None
#
return None
except
(
smtplib
.
SMTPException
,
smtplib
.
SMTPAuthenticationError
)
as
e
:
except
(
smtplib
.
SMTPException
,
smtplib
.
SMTPAuthenticationError
)
as
e
:
if
hasattr
(
e
,
"smtp_error"
):
if
hasattr
(
e
,
"smtp_error"
):
text
=
e
.
smtp_error
.
decode
(
'utf-8'
)
.
replace
(
"
\n
"
,
'. '
)
text
=
e
.
smtp_error
.
decode
(
'utf-8'
)
.
replace
(
"
\n
"
,
'. '
)
...
@@ -181,10 +181,11 @@ class TaskEmail(CalibreTask):
...
@@ -181,10 +181,11 @@ class TaskEmail(CalibreTask):
log
.
exception
(
e
)
log
.
exception
(
e
)
text
=
''
text
=
''
self
.
_handleError
(
u'Smtplib Error sending email: '
+
text
)
self
.
_handleError
(
u'Smtplib Error sending email: '
+
text
)
return
None
#
return None
except
(
socket
.
error
)
as
e
:
except
(
socket
.
error
)
as
e
:
self
.
_handleError
(
u'Socket Error sending email: '
+
e
.
strerror
)
self
.
_handleError
(
u'Socket Error sending email: '
+
e
.
strerror
)
return
None
# return None
@
property
@
property
def
progress
(
self
):
def
progress
(
self
):
...
...
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