mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
GwR Fetch annotations marks books as read if > 96%
This commit is contained in:
parent
bb8985c6d5
commit
3fcb4a4883
@ -982,6 +982,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
|
|
||||||
update_progress = pyqtSignal(int)
|
update_progress = pyqtSignal(int)
|
||||||
update_done = pyqtSignal()
|
update_done = pyqtSignal()
|
||||||
|
FINISHED_READING_PCT_THRESHOLD = 96
|
||||||
|
|
||||||
def __init__(self, parent, db, annotation_map, done_callback):
|
def __init__(self, parent, db, annotation_map, done_callback):
|
||||||
QThread.__init__(self, parent)
|
QThread.__init__(self, parent)
|
||||||
@ -1064,6 +1065,10 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
ka_soup.insert(0,divTag)
|
ka_soup.insert(0,divTag)
|
||||||
return ka_soup
|
return ka_soup
|
||||||
|
|
||||||
|
def mark_book_as_read(self,id):
|
||||||
|
read_tag = gprefs.get('catalog_epub_mobi_read_tag')
|
||||||
|
self.db.set_tags(id, [read_tag], append=True)
|
||||||
|
|
||||||
def canceled(self):
|
def canceled(self):
|
||||||
self.pd.hide()
|
self.pd.hide()
|
||||||
|
|
||||||
@ -1091,6 +1096,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
mi.comments = unicode(user_notes_soup.prettify())
|
mi.comments = unicode(user_notes_soup.prettify())
|
||||||
# Update library comments
|
# Update library comments
|
||||||
self.db.set_comment(id, mi.comments)
|
self.db.set_comment(id, mi.comments)
|
||||||
|
# Update 'read' tag
|
||||||
|
if bm.bookmark.percent_read >= self.FINISHED_READING_PCT_THRESHOLD:
|
||||||
|
self.mark_book_as_read(id)
|
||||||
# Add bookmark file to id
|
# Add bookmark file to id
|
||||||
self.db.add_format_with_hooks(id, bm.bookmark.bookmark_extension,
|
self.db.add_format_with_hooks(id, bm.bookmark.bookmark_extension,
|
||||||
bm.bookmark.path, index_is_id=True)
|
bm.bookmark.path, index_is_id=True)
|
||||||
|
@ -51,32 +51,6 @@ class PersistentTemporaryFile(object):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def startswith(self,*args):
|
|
||||||
if len(args):
|
|
||||||
str = args[0]
|
|
||||||
beg = 0
|
|
||||||
end = len(str)
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if len(args) > 1:
|
|
||||||
begin = args[1]
|
|
||||||
if len(args) > 2:
|
|
||||||
end = args[2]
|
|
||||||
if self._name[beg:end].startswith(str):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def split(self,*args):
|
|
||||||
if len(args):
|
|
||||||
sep = args[0]
|
|
||||||
if len(args) > 1:
|
|
||||||
maxsplit = args[1]
|
|
||||||
return self._name.split(sep,maxsplit)
|
|
||||||
else:
|
|
||||||
return self._name.split(sep)
|
|
||||||
|
|
||||||
|
|
||||||
def PersistentTemporaryDirectory(suffix='', prefix='', dir=None):
|
def PersistentTemporaryDirectory(suffix='', prefix='', dir=None):
|
||||||
'''
|
'''
|
||||||
Return the path to a newly created temporary directory that will
|
Return the path to a newly created temporary directory that will
|
||||||
|
Loading…
x
Reference in New Issue
Block a user