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
1a9b220e
Commit
1a9b220e
authored
Dec 08, 2020
by
Ozzieisaacs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Session no longer expires on commit (only in worker thread)
parent
d15d252a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
db.py
cps/db.py
+1
-1
convert.py
cps/tasks/convert.py
+4
-3
No files found.
cps/db.py
View file @
1a9b220e
...
...
@@ -426,7 +426,7 @@ class CalibreDB():
# instances alive once they reach the end of their respective scopes
instances
=
WeakSet
()
def
__init__
(
self
,
expire_on_commit
=
Fals
e
):
def
__init__
(
self
,
expire_on_commit
=
Tru
e
):
""" Initialize a new CalibreDB session
"""
self
.
session
=
None
...
...
cps/tasks/convert.py
View file @
1a9b220e
...
...
@@ -33,10 +33,9 @@ class TaskConvert(CalibreTask):
def
run
(
self
,
worker_thread
):
self
.
worker_thread
=
worker_thread
if
config
.
config_use_google_drive
:
worker_db
=
db
.
CalibreDB
()
worker_db
=
db
.
CalibreDB
(
expire_on_commit
=
False
)
cur_book
=
worker_db
.
get_book
(
self
.
bookid
)
data
=
worker_db
.
get_book_format
(
self
.
bookid
,
self
.
settings
[
'old_book_format'
])
worker_db
.
session
.
close
()
df
=
gdriveutils
.
getFileFromEbooksFolder
(
cur_book
.
path
,
data
.
name
+
"."
+
self
.
settings
[
'old_book_format'
]
.
lower
())
if
df
:
...
...
@@ -46,10 +45,12 @@ class TaskConvert(CalibreTask):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
cur_book
.
path
)):
os
.
makedirs
(
os
.
path
.
join
(
config
.
config_calibre_dir
,
cur_book
.
path
))
df
.
GetContentFile
(
datafile
)
worker_db
.
session
.
close
()
else
:
error_message
=
_
(
u"
%(format)
s not found on Google Drive:
%(fn)
s"
,
format
=
self
.
settings
[
'old_book_format'
],
fn
=
data
.
name
+
"."
+
self
.
settings
[
'old_book_format'
]
.
lower
())
worker_db
.
session
.
close
()
return
error_message
filename
=
self
.
_convert_ebook_format
()
...
...
@@ -73,7 +74,7 @@ class TaskConvert(CalibreTask):
def
_convert_ebook_format
(
self
):
error_message
=
None
local_db
=
db
.
CalibreDB
()
local_db
=
db
.
CalibreDB
(
expire_on_commit
=
False
)
file_path
=
self
.
file_path
book_id
=
self
.
bookid
format_old_ext
=
u'.'
+
self
.
settings
[
'old_book_format'
]
.
lower
()
...
...
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