diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py
index ae1cc52e2c..c88a443689 100644
--- a/src/calibre/devices/kindle/driver.py
+++ b/src/calibre/devices/kindle/driver.py
@@ -179,7 +179,7 @@ class Bookmark():
self.get_bookmark_data()
self.get_book_length()
try:
- self.percent_read = float(100*self.last_read / self.book_length)
+ self.percent_read = min(float(100*self.last_read / self.book_length),100)
except:
self.percent_read = 0
diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py
index dc5f26143b..c83cba48ec 100644
--- a/src/calibre/gui2/ui.py
+++ b/src/calibre/gui2/ui.py
@@ -1075,12 +1075,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.pd.hide()
def run(self):
+ ignore_tags = set(['Catalog','Clippings'])
for (i, id) in enumerate(self.am):
bm = Device.UserAnnotation(self.am[id][0],self.am[id][1])
if bm.type == 'kindle_bookmark':
- user_notes_soup = self.generate_annotation_html(bm.value)
-
mi = self.db.get_metadata(id, index_is_id=True)
+ user_notes_soup = self.generate_annotation_html(bm.value)
if mi.comments:
a_offset = mi.comments.find('
')
ad_offset = mi.comments.find('
')
@@ -1089,6 +1089,8 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
mi.comments = mi.comments[:a_offset]
if ad_offset >= 0:
mi.comments = mi.comments[:ad_offset]
+ if set(mi.tags).intersection(ignore_tags):
+ continue
if mi.comments:
hrTag = Tag(user_notes_soup,'hr')
hrTag['class'] = 'annotations_divider'
@@ -1099,9 +1101,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
mi.comments = unicode(user_notes_soup.prettify())
# Update library comments
self.db.set_comment(id, mi.comments)
- # Update 'read' tag
+
+ # Update 'read' tag except for Catalogs/Clippings
if bm.value.percent_read >= self.FINISHED_READING_PCT_THRESHOLD:
- self.mark_book_as_read(id)
+ if not set(mi.tags).intersection(ignore_tags):
+ self.mark_book_as_read(id)
+
# Add bookmark file to id
self.db.add_format_with_hooks(id, bm.value.bookmark_extension,
bm.value.path, index_is_id=True)
diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py
index c29f198159..560135c2df 100644
--- a/src/calibre/library/catalog.py
+++ b/src/calibre/library/catalog.py
@@ -1261,7 +1261,7 @@ class EPUB_MOBI(CatalogPlugin):
bookmark_ext = path_map[id].rpartition('.')[2]
myBookmark = Bookmark(path_map[id], id, book_ext[id], bookmark_ext)
try:
- book['percent_read'] = float(100*myBookmark.last_read / myBookmark.book_length)
+ book['percent_read'] = min(float(100*myBookmark.last_read / myBookmark.book_length),100)
except:
book['percent_read'] = 0
dots = int((book['percent_read'] + 5)/10)
@@ -2113,7 +2113,7 @@ class EPUB_MOBI(CatalogPlugin):
#print "bm_book: %s" % bm_book
book[1]['bookmark_timestamp'] = book[0].timestamp
try:
- book[1]['percent_read'] = float(100*book[0].last_read / book[0].book_length)
+ book[1]['percent_read'] = min(float(100*book[0].last_read / book[0].book_length),100)
except:
book[1]['percent_read'] = 0
bookmarked_books.append(book[1])