kindle manager

This commit is contained in:
gavin
2020-06-07 17:48:28 +08:00
parent 76cc0d8c6d
commit 32d9f53897
7 changed files with 324 additions and 63 deletions

12
kman.py
View File

@@ -70,6 +70,7 @@ DEBUG = 1 # 0 - INFO; 1 - DEBUG
LOG2FILE = 1 # 0 - to stdio; 1 - to file
LOGFILE = 'log'
DELIMITER= '|'
#HEADER = {0:'type',1:'bookname',2:'author',3:'position',4:'date',5:'content'}
# log info
logger = logging.getLogger()
@@ -357,9 +358,13 @@ class kMan:
bks: books dict
info: filter by bookname or author information
tp: type to be filter
0: top/root item clicked
0: root item clicked
1: bookname item clicked
2: author item clicked
Return: list:
[[Type,Bookname,Author,Position,Date,content],
[Type,Bookname,Author,Position,Date,content]
....]
"""
nbks = defaultdict(dict)
@@ -378,9 +383,10 @@ class kMan:
if ks in ['author', 'lines']: continue
tm = self.format_time(' '.join([vs['day'],vs['week'], \
vs['meridiem'],vs['time']]))
tp = '标注' if vs['type']=='HL' else '笔记'
seclist.append((vs['content'],tp,kb,vb['author'],vs['position'],tm))
nttype = '标注' if vs['type']=='HL' else '笔记'
seclist.append([nttype,kb,vb['author'],vs['position'],tm,vs['content']])
idx += 1
return seclist
def add_note_to_highlight(self,bks):