mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Avoid creating metadata.opf files in the root of the library when adding books
This commit is contained in:
parent
fddf3abf92
commit
3839b99e9c
@ -654,6 +654,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
|
|
||||||
def get_metadata_for_dump(self, idx, remove_from_dirtied=True):
|
def get_metadata_for_dump(self, idx, remove_from_dirtied=True):
|
||||||
try:
|
try:
|
||||||
|
path, mi = (None, None)
|
||||||
|
# While a book is being created, the path is empty. Don't bother to
|
||||||
|
# try to write the opf, because it will go to the wrong folder.
|
||||||
|
if self.path(idx, index_is_id=True):
|
||||||
path = os.path.join(self.abspath(idx, index_is_id=True), 'metadata.opf')
|
path = os.path.join(self.abspath(idx, index_is_id=True), 'metadata.opf')
|
||||||
mi = self.get_metadata(idx, index_is_id=True)
|
mi = self.get_metadata(idx, index_is_id=True)
|
||||||
# Always set cover to cover.jpg. Even if cover doesn't exist,
|
# Always set cover to cover.jpg. Even if cover doesn't exist,
|
||||||
@ -663,7 +667,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
except:
|
except:
|
||||||
# This almost certainly means that the book has been deleted while
|
# This almost certainly means that the book has been deleted while
|
||||||
# the backup operation sat in the queue.
|
# the backup operation sat in the queue.
|
||||||
path, mi = (None, None)
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# clear the dirtied indicator. The user must put it back if
|
# clear the dirtied indicator. The user must put it back if
|
||||||
|
Loading…
x
Reference in New Issue
Block a user