mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix #849469 (Calibre not closing metadata.db after copy to library)
This commit is contained in:
parent
92fdad1ef3
commit
08ce94f3a0
@ -8,6 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import os
|
import os
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
from contextlib import closing
|
||||||
|
|
||||||
from PyQt4.Qt import QToolButton
|
from PyQt4.Qt import QToolButton
|
||||||
|
|
||||||
@ -53,6 +54,10 @@ class Worker(Thread): # {{{
|
|||||||
def doit(self):
|
def doit(self):
|
||||||
from calibre.library.database2 import LibraryDatabase2
|
from calibre.library.database2 import LibraryDatabase2
|
||||||
newdb = LibraryDatabase2(self.loc)
|
newdb = LibraryDatabase2(self.loc)
|
||||||
|
with closing(newdb):
|
||||||
|
self._doit(newdb)
|
||||||
|
|
||||||
|
def _doit(self, newdb):
|
||||||
for i, x in enumerate(self.ids):
|
for i, x in enumerate(self.ids):
|
||||||
mi = self.db.get_metadata(x, index_is_id=True, get_cover=True,
|
mi = self.db.get_metadata(x, index_is_id=True, get_cover=True,
|
||||||
cover_as_data=True)
|
cover_as_data=True)
|
||||||
@ -111,6 +116,7 @@ class Worker(Thread): # {{{
|
|||||||
os.remove(path)
|
os.remove(path)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class CopyToLibraryAction(InterfaceAction):
|
class CopyToLibraryAction(InterfaceAction):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user