kindle manager
This commit is contained in:
10
kman.py
10
kman.py
@@ -135,7 +135,7 @@ class kMan:
|
||||
if not kp:
|
||||
s2 = u'Disconnected ({})'.format(os.path.join(CURRPATH,CLIPFN))
|
||||
else:
|
||||
with open(kp+'/system/version.txt' , 'r', encoding='utf8', errors='ignore') as f:
|
||||
with open(os.path.join(kp,'system','version.txt'), 'r', encoding='utf8', errors='ignore') as f:
|
||||
s2 = u'Connected ({}) version {}'.format(kp,f.read().strip())
|
||||
|
||||
return [s1,s2]
|
||||
@@ -313,7 +313,7 @@ class kMan:
|
||||
"""
|
||||
|
||||
suff = {'MD':'.md','CSV':'.csv','JSON':'.json'}
|
||||
op = fnpref+suff[ft]
|
||||
op = os.path.join(CURRPATH, fnpref+suff[ft])
|
||||
|
||||
with open(op, 'w', encoding='utf8', errors='ignore') as fw:
|
||||
if ft=='JSON':
|
||||
@@ -347,7 +347,7 @@ class kMan:
|
||||
"""
|
||||
|
||||
suff = {'MD':'.md','CSV':'.csv','JSON':'.json'}
|
||||
op = fnpref+suff[ft]
|
||||
op = os.path.join(CURRPATH,fnpref+suff[ft])
|
||||
|
||||
with open(op, 'w', encoding='utf8', errors='ignore') as fw:
|
||||
if ft=='JSON':
|
||||
@@ -834,9 +834,9 @@ if __name__=='__main__':
|
||||
km.add_note_to_highlight(books)
|
||||
|
||||
# test dict json convert
|
||||
with open('./xx', 'w', encoding='utf8', errors='ignore') as fw:
|
||||
with open(os.path.join(CURRPATH,'xx', 'w'), encoding='utf8', errors='ignore') as fw:
|
||||
fw.write(km.dict2json(books))
|
||||
if km.json2dict('./xx')==books: print( 'test OK')
|
||||
if km.json2dict(os.path.join(CURRPATH,'xx'))==books: print( 'test OK')
|
||||
|
||||
km.export_notes(books, OUTPREF, ft='MD')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user