mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
077486c4f7
@ -1108,25 +1108,19 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.update_progress.emit(i)
|
self.update_progress.emit(i)
|
||||||
elif bm.type == 'kindle_clippings':
|
elif bm.type == 'kindle_clippings':
|
||||||
# Find 'My Clippings' author=Kindle in database, or add
|
# Find 'My Clippings' author=Kindle in database, or add
|
||||||
self.db.search('title:"My Clippings" author:Kindle')
|
|
||||||
data = self.db.get_data_as_dict()
|
|
||||||
last_update = 'Last modified %s' % strftime(u'%x %X',bm.value['timestamp'].timetuple())
|
last_update = 'Last modified %s' % strftime(u'%x %X',bm.value['timestamp'].timetuple())
|
||||||
if data:
|
mc_id = list(db.data.parse('title:"My Clippings"'))
|
||||||
do_add_format(self.db, data[0]['id'], 'TXT', bm.value['path'])
|
if mc_id:
|
||||||
mi = self.db.get_metadata(data[0]['id'], index_is_id=True)
|
do_add_format(self.db, mc_id[0], 'TXT', bm.value['path'])
|
||||||
|
mi = self.db.get_metadata(mc_id[0], index_is_id=True)
|
||||||
mi.comments = last_update
|
mi.comments = last_update
|
||||||
self.db.set_metadata(data[0]['id'], mi)
|
self.db.set_metadata(mc_id[0], mi)
|
||||||
else:
|
else:
|
||||||
mi = MetaInformation('My Clippings', authors = ['Kindle'])
|
mi = MetaInformation('My Clippings', authors = ['Kindle'])
|
||||||
mi.tags = ['Clippings']
|
mi.tags = ['Clippings']
|
||||||
mi.comments = last_update
|
mi.comments = last_update
|
||||||
self.db.add_books([bm.value['path']], ['txt'], [mi])
|
self.db.add_books([bm.value['path']], ['txt'], [mi])
|
||||||
|
|
||||||
# KG: This doesn't seem right, but without it the main window
|
|
||||||
# shows the results of the last search for 'My Clippings' instead of
|
|
||||||
# its previous contents
|
|
||||||
self.db.search('')
|
|
||||||
|
|
||||||
self.update_done.emit()
|
self.update_done.emit()
|
||||||
self.done_callback(self.am.keys())
|
self.done_callback(self.am.keys())
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user