mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression in Sony device-pane metadata editing
This commit is contained in:
parent
d000fbc7b2
commit
2a0936f14f
@ -350,9 +350,7 @@ class XMLCache(object):
|
|||||||
record = lpath_map.get(book.lpath, None)
|
record = lpath_map.get(book.lpath, None)
|
||||||
if record is None:
|
if record is None:
|
||||||
record = self.create_text_record(root, i, book.lpath)
|
record = self.create_text_record(root, i, book.lpath)
|
||||||
date = self.check_timestamp(record, book, path)
|
self.update_text_record(record, book, path, i)
|
||||||
if date is not None:
|
|
||||||
self.update_text_record(record, book, date, path, i)
|
|
||||||
# Ensure the collections in the XML database are recorded for
|
# Ensure the collections in the XML database are recorded for
|
||||||
# this book
|
# this book
|
||||||
if book.device_collections is None:
|
if book.device_collections is None:
|
||||||
@ -443,23 +441,15 @@ class XMLCache(object):
|
|||||||
root.append(ans)
|
root.append(ans)
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
def check_timestamp(self, record, book, path):
|
def update_text_record(self, record, book, path, bl_index):
|
||||||
'''
|
|
||||||
Checks the timestamp in the Sony DB against the file. If different,
|
|
||||||
return the file timestamp. Otherwise return None.
|
|
||||||
'''
|
|
||||||
timestamp = os.path.getmtime(path)
|
|
||||||
date = strftime(timestamp)
|
|
||||||
if date != record.get('date', None):
|
|
||||||
return date
|
|
||||||
return None
|
|
||||||
|
|
||||||
def update_text_record(self, record, book, date, path, bl_index):
|
|
||||||
'''
|
'''
|
||||||
Update the Sony database from the book. This is done if the timestamp in
|
Update the Sony database from the book. This is done if the timestamp in
|
||||||
the db differs from the timestamp on the file.
|
the db differs from the timestamp on the file.
|
||||||
'''
|
'''
|
||||||
record.set('date', date)
|
timestamp = os.path.getmtime(path)
|
||||||
|
date = strftime(timestamp)
|
||||||
|
if date != record.get('date', None):
|
||||||
|
record.set('date', date)
|
||||||
record.set('size', str(os.stat(path).st_size))
|
record.set('size', str(os.stat(path).st_size))
|
||||||
title = book.title if book.title else _('Unknown')
|
title = book.title if book.title else _('Unknown')
|
||||||
record.set('title', title)
|
record.set('title', title)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user