kindle manager

This commit is contained in:
gavin
2020-06-30 12:58:59 +08:00
parent cf454693b6
commit 247a5cf2f3
7 changed files with 11 additions and 54 deletions

File diff suppressed because one or more lines are too long

BIN
downimg/s28026215.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -593,10 +593,7 @@ class kMan:
#serr = str(stream_stderr.read()) #serr = str(stream_stderr.read())
#if sout: print('stdout {}'.format(sout)) #if sout: print('stdout {}'.format(sout))
#if serr: print('stderr {}'.format(serr)) #if serr: print('stderr {}'.format(serr))
<<<<<<< HEAD
=======
#print('os.name {} sout {}'.format(os.name,sout)) #print('os.name {} sout {}'.format(os.name,sout))
>>>>>>> 2d53124ab9aa26c9733646348174311d0967c8c0
if os.name == 'nt': # windows if os.name == 'nt': # windows
for d in sout.split('\n'): for d in sout.split('\n'):
if 'Kindle' in d: if 'Kindle' in d:

View File

@@ -52,7 +52,7 @@ infos_temp = """<table border="0">
</td> </td>
<td style="border-left:1px solid lightgray;"> </td> <td style="border-left:1px solid lightgray;"> </td>
<td width=100> </td> <td width=100> </td>
<td> <img style="max-width:220px;" src="./downimg/{img}" > </td> <td> <img style="max-width:220px;" src="{currpath}/downimg/{img}" > </td>
</tr> </tr>
</table>""" </table>"""
@@ -90,13 +90,10 @@ class kmanWindow(QMainWindow):
self.km = kMan() self.km = kMan()
self.spide = bookInfoSpide() self.spide = bookInfoSpide()
<<<<<<< HEAD
=======
### in order to smaller the package, ### in order to smaller the package,
### substitute pandas table with mTable ### substitute pandas table with mTable
self.mt = mTable() self.mt = mTable()
>>>>>>> 2d53124ab9aa26c9733646348174311d0967c8c0
self.books_info = defaultdict(dict) self.books_info = defaultdict(dict)
# initial check order: # initial check order:
# 1. backup file bk.data -> # 1. backup file bk.data ->
@@ -120,19 +117,10 @@ class kmanWindow(QMainWindow):
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data) [self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
#self.filter_list = self.km.filter_words(self.words_data) #self.filter_list = self.km.filter_words(self.words_data)
self.create_books_info_daemon()
###############################################################
## move to create_books_info_daemon
###############################################################
# initial books information which grab from douban or amazon # initial books information which grab from douban or amazon
# if the information exist in backup file, initial with this file, # if the information exist in backup file, initial with this file,
# and grap new book's information from douban # and grap new book's information from douban
# else grap all book information from douban # else grap all book information from douban
<<<<<<< HEAD
"""
=======
>>>>>>> 2d53124ab9aa26c9733646348174311d0967c8c0
try: try:
if os.path.exists(BACKUPINFOFN): if os.path.exists(BACKUPINFOFN):
self.books_info = self.km.json2dict(BACKUPINFOFN) self.books_info = self.km.json2dict(BACKUPINFOFN)
@@ -150,7 +138,6 @@ class kmanWindow(QMainWindow):
print(e) print(e)
finally: finally:
pass pass
"""
self.fill_treeview() self.fill_treeview()
self.refresh_ui_component(comp=1) self.refresh_ui_component(comp=1)
@@ -344,7 +331,8 @@ class kmanWindow(QMainWindow):
publisher=vv['publisher'], publisher=vv['publisher'],
publishing=vv['publishing'], publishing=vv['publishing'],
description=vv['description'], description=vv['description'],
img=vv['img'].split('/')[-1])) img=vv['img'].split('/')[-1],
currpath=CURRPATH))
self.copyinfo = """ 1 | :green_book: | [{bookname}]({link}) | """ \ self.copyinfo = """ 1 | :green_book: | [{bookname}]({link}) | """ \
"""{author}/{score}/{publisher}/{publishing} {description}""" \ """{author}/{score}/{publisher}/{publishing} {description}""" \
@@ -596,8 +584,6 @@ class kmanWindow(QMainWindow):
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data) [self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
self.filter_wordlist = self.km.filter_words(self.words_data) self.filter_wordlist = self.km.filter_words(self.words_data)
#self.create_books_info_daemon()
self.fill_treeview() self.fill_treeview()
self.refresh_ui_component(1) self.refresh_ui_component(1)
@@ -611,8 +597,6 @@ class kmanWindow(QMainWindow):
self.books_data = self.km.import_clips(fn) self.books_data = self.km.import_clips(fn)
[self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data) [self.filter_books, self.filter_list] = self.km.filter_clips(self.books_data)
#self.create_books_info_daemon()
self.fill_treeview() self.fill_treeview()
self.refresh_ui_component(1) self.refresh_ui_component(1)
@@ -830,33 +814,6 @@ class kmanWindow(QMainWindow):
if bks_info: return self.books_info.update(bks_info) if bks_info: return self.books_info.update(bks_info)
def create_books_info_daemon(self):
# initial books information which grab from douban or amazon
# if the information exist in backup file, initial with this file,
# and grap new book's information from douban
# else grap all book information from douban
try:
if os.path.exists(BACKUPINFOFN):
self.books_info = self.km.json2dict(BACKUPINFOFN)
increase_book_list = self.check_increase_books(self.books_data, self.books_info)
if len(increase_book_list) > 0:
trd = threading.Thread(target=self.grab_books_info, args=(increase_book_list,))
trd.setDaemon(True)
trd.start()
else:
booklist = list(self.books_data.keys())
trd = threading.Thread(target=self.grab_books_info, args=(book_list,))
trd.setDaemon(True)
trd.start()
except Exception as e:
print(e)
finally:
self.fill_treeview()
self.refresh_ui_component(1)
pass
# thanks Martin Fitzpatrick ^_^ # thanks Martin Fitzpatrick ^_^
# https://www.learnpyqt.com/courses/model-views/qtableview-modelviews-numpy-pandas/ # https://www.learnpyqt.com/courses/model-views/qtableview-modelviews-numpy-pandas/
class nTableModel(QAbstractTableModel): class nTableModel(QAbstractTableModel):

7
ru Executable file
View File

@@ -0,0 +1,7 @@
./cr;
./rel;
rm -fr Release/kmanapp
open Release/kmanapp.app;