kindle manager

This commit is contained in:
gavin
2020-06-18 14:00:42 +08:00
parent dff52d3f48
commit a22934d61d
11 changed files with 32 additions and 7 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -7,6 +7,9 @@
<br> <br>
![mainwindow.png](https://i.loli.net/2020/06/16/1TDvqCOnFmegUsy.png) ![mainwindow.png](https://i.loli.net/2020/06/16/1TDvqCOnFmegUsy.png)
![mainwindow2.png](https://i.loli.net/2020/06/18/bsQvYr5Ei82kafJ.png)
![mainwindow1.png](https://i.loli.net/2020/06/18/gerMaG45hc2tIkq.png)
## CHANGE LOG ## CHANGE LOG
[ChangeLog](changelog.md) 这里记录迭代过程,及过程中记录的一些功能的想法, [ChangeLog](changelog.md) 这里记录迭代过程,及过程中记录的一些功能的想法,

File diff suppressed because one or more lines are too long

1
backup/x.bk.info.data.bk Normal file

File diff suppressed because one or more lines are too long

BIN
design/mainwindow1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

BIN
design/mainwindow2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

BIN
downimg/p2233249734.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
downimg/s29452451.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@@ -43,10 +43,11 @@ infos_temp = """<table border="0">
<font size="4" color="black"></font><br> <font size="4" color="black"></font><br>
<a href={link}><font size="8" color="darkred">{bookname}</font></a><br><br> <a href={link}><font size="8" color="darkred">{bookname}</font></a><br><br>
<font size="4" color="black">作者 : {author}</font><br><br> <font size="4" color="black">作者 : {author}</font><br><br>
<font size="4" color="yellow">评论数 : {ratenum}</font> <br><br> <font size="4" color=#31849B>评论数 : {ratenum}</font> <br><br>
<font size="4" color="black">评分 : {score}</font> <br><br> <font size="4" color="black">评分 : {score}</font> <br><br>
<font size="4" color="green">出版社 : {publisher}</font><br><br> <font size="4" color="green">出版社 : {publisher}</font><br><br>
<font size="4">出版时间 : {publishing}</font> <br><br> <font size="4">出版时间 : {publishing}</font> <br><br>
<font size="4" color=#31849B>内容简介 : {description}</font> <br><br>
</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>
@@ -263,6 +264,7 @@ class kmanWindow(QMainWindow):
"ratenum": "893", "ratenum": "893",
"publisher": "中信出版社", "publisher": "中信出版社",
"publishing": "2014", "publishing": "2014",
"description": "xxx",
"author": "【美】伯南克/巴曙松" "author": "【美】伯南克/巴曙松"
} }
''' '''
@@ -278,7 +280,8 @@ class kmanWindow(QMainWindow):
self.ui.textEdit.setHtml(infos_temp.format(link=vv['link'],bookname=vv['bookname'], self.ui.textEdit.setHtml(infos_temp.format(link=vv['link'],bookname=vv['bookname'],
author=vv['author'], ratenum=vv['ratenum'], author=vv['author'], ratenum=vv['ratenum'],
score=vv['score'], publisher=vv['publisher'], score=vv['score'], publisher=vv['publisher'],
publishing=vv['publishing'],img=vv['img'].split('/')[-1])) publishing=vv['publishing'],description=vv['description'],
img=vv['img'].split('/')[-1]))
else: pass else: pass

View File

@@ -87,7 +87,8 @@ testbooks =['24堂财富课',
class bookInfoSpide(): class bookInfoSpide():
[re_bn,re_bn,re_score,re_star,re_author,re_end]=[None,None,None,None,None,None] [re_bn,re_bn,re_score,re_star,re_author,re_description,re_end] \
=[None,None,None,None,None,None,None]
if ISDOUBAN==1: if ISDOUBAN==1:
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\".+?rating_nums\">(.+?)<''', re.S) re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\".+?rating_nums\">(.+?)<''', re.S)
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\"''') re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\"''')
@@ -95,6 +96,7 @@ class bookInfoSpide():
re_score=re.compile(r'''class=\"rating_nums\">(.+?)<''') re_score=re.compile(r'''class=\"rating_nums\">(.+?)<''')
re_ratenum=re.compile(r'''^<span>\((\d+)人评价\)</span>''') re_ratenum=re.compile(r'''^<span>\((\d+)人评价\)</span>''')
re_author=re.compile(r'''class=\"subject-cast\">(.+?)<''') re_author=re.compile(r'''class=\"subject-cast\">(.+?)<''')
re_description=re.compile(r'''^<p>(.+?)(<\/p>){0,1}$''')
else: else:
re_asin=re.compile(r'''^<div data-asin=\"(.+?)\" data-index''') re_asin=re.compile(r'''^<div data-asin=\"(.+?)\" data-index''')
re_img=re.compile(r'''^<img src=\"(.+?)\"$''') re_img=re.compile(r'''^<img src=\"(.+?)\"$''')
@@ -118,6 +120,7 @@ class bookInfoSpide():
"ratenum": "1000", "ratenum": "1000",
"author": "猫腻" "author": "猫腻"
"publisher": "中华书局" "publisher": "中华书局"
"description": "XXX"
"publishing": "2015" "publishing": "2015"
},...} },...}
""" """
@@ -189,7 +192,14 @@ class bookInfoSpide():
bkinfo[sid]['author']='/'.join(author) bkinfo[sid]['author']='/'.join(author)
else: else:
bkinfo[sid]['author']=ret[0] bkinfo[sid]['author']=ret[0]
stat='DESCRIPTION'
continue
elif stat=='DESCRIPTION':
ret=re.search(self.re_description, line)
if ret:
bkinfo[sid]['description']=ret.group(1).strip()
stat='SID' stat='SID'
continue
else: continue else: continue
else: else:
stat='ASIN' stat='ASIN'
@@ -271,7 +281,7 @@ class bookInfoSpide():
mbkn=mbkinfo[0] mbkn=mbkinfo[0]
for k,v in mbkinfo[1].items(): for k,v in mbkinfo[1].items():
bkn=v['bookname'] bkn=v['bookname']
if len(v)==8: if len(v)==9:
if (not f1) and (mbkn in bkn): if (not f1) and (mbkn in bkn):
f1=1 f1=1
d1={mbkn:v} d1={mbkn:v}

View File

@@ -86,7 +86,7 @@ testbooks=['24堂财富课',
class bookInfoSpide(): class bookInfoSpide():
[re_bn,re_bn,re_score,re_star,re_author,re_end]=[None,None,None,None,None,None] [re_bn,re_bn,re_score,re_star,re_author,re_description,re_end]=[None,None,None,None,None,None,None]
if ISDOUBAN==1: if ISDOUBAN==1:
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\".+?rating_nums\">(.+?)<''', re.S) re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\".+?rating_nums\">(.+?)<''', re.S)
re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\"''') re_bn=re.compile(r'''class=\"nbg.+?sid: (\d+?),.+?title=\"(.+?)\".+?img src=\"(.+?)\"''')
@@ -94,6 +94,7 @@ class bookInfoSpide():
re_score=re.compile(r'''class=\"rating_nums\">(.+?)<''') re_score=re.compile(r'''class=\"rating_nums\">(.+?)<''')
re_ratenum=re.compile(r'''^<span>\((\d+)人评价\)</span>''') re_ratenum=re.compile(r'''^<span>\((\d+)人评价\)</span>''')
re_author=re.compile(r'''class=\"subject-cast\">(.+?)<''') re_author=re.compile(r'''class=\"subject-cast\">(.+?)<''')
re_description=re.compile(r'''^<p>(.+?)(<\/p>){0,1}$''')
else: else:
re_asin=re.compile(r'''^<div data-asin=\"(.+?)\" data-index''') re_asin=re.compile(r'''^<div data-asin=\"(.+?)\" data-index''')
re_img=re.compile(r'''^<img src=\"(.+?)\"$''') re_img=re.compile(r'''^<img src=\"(.+?)\"$''')
@@ -195,7 +196,14 @@ class bookInfoSpide():
bkinfo[sid]['author']='/'.join(author) bkinfo[sid]['author']='/'.join(author)
else: else:
bkinfo[sid]['author']=ret[0] bkinfo[sid]['author']=ret[0]
stat='DESCRIPTION'
continue
elif stat=='DESCRIPTION':
ret=re.search(self.re_description, line)
if ret:
bkinfo[sid]['description']=ret.group(1)
stat='SID' stat='SID'
continue
else: continue else: continue
else: else:
stat='ASIN' stat='ASIN'
@@ -277,7 +285,7 @@ class bookInfoSpide():
mbkn=mbkinfo[0] mbkn=mbkinfo[0]
for k,v in mbkinfo[1].items(): for k,v in mbkinfo[1].items():
bkn=v['bookname'] bkn=v['bookname']
if len(v)==8: if len(v)==9:
if (not f1) and (mbkn in bkn): if (not f1) and (mbkn in bkn):
f1=1 f1=1
d1={mbkn:v} d1={mbkn:v}