mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Book polishing: Apply null comments
Book polishing: Do not leave behind the old comments when updating metadata if the comments have been deleted in calibre.
This commit is contained in:
parent
0394f6d01f
commit
d32a1c7bb7
1 changed files with 6 additions and 2 deletions
|
|
@ -30,7 +30,8 @@ class ContainerException(OCFException):
|
|||
|
||||
class Container(dict):
|
||||
def __init__(self, stream=None):
|
||||
if not stream: return
|
||||
if not stream:
|
||||
return
|
||||
soup = BeautifulStoneSoup(stream.read())
|
||||
container = soup.find(name=re.compile(r'container$', re.I))
|
||||
if not container:
|
||||
|
|
@ -256,7 +257,8 @@ def update_metadata(opf, mi, apply_null=False, update_timestamp=False):
|
|||
langs = []
|
||||
for lc in mi.languages:
|
||||
lc2 = lang_as_iso639_1(lc)
|
||||
if lc2: lc = lc2
|
||||
if lc2:
|
||||
lc = lc2
|
||||
langs.append(lc)
|
||||
mi.languages = langs
|
||||
|
||||
|
|
@ -270,6 +272,8 @@ def update_metadata(opf, mi, apply_null=False, update_timestamp=False):
|
|||
opf.tags = []
|
||||
if not getattr(mi, 'isbn', None):
|
||||
opf.isbn = None
|
||||
if not getattr(mi, 'comments', None):
|
||||
opf.comments = None
|
||||
if update_timestamp and mi.timestamp is not None:
|
||||
opf.timestamp = mi.timestamp
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue