diff --git a/changelog.md b/changelog.md index 3ede69b..9a22d17 100644 --- a/changelog.md +++ b/changelog.md @@ -4,6 +4,7 @@ ## 1.0.0 (20200526) ### create +- unittest - abstract note/bookmark/highlight from kindle clipping - formatter output to special file @@ -37,6 +38,8 @@ b['1']['2'] = {'3':1} # OK ``` (authinfo, dateinfo, content) = (s[0], s[1], s[2] if len(s)==3 else None) ``` +- unittest error line number is not collect, **unitest bug**? +- **unitest testcase execution sequence is disorder, so must create test data for each case** ## 1.0.2 (20200530) ### feature @@ -59,10 +62,12 @@ b['1']['2'] = {'3':1} # OK # feature plan ## 20200528 - first abstract from kindle hard / local directory for different OS -- add GUI use QT - - - - +- add GUI use QT **done** +## 20200604 +- refactoring kman.py + - creat constant class for all constant + - creat config dialog to do some constant configuration + - creat xman class for all clipping manipulation + - design config dialog & statusbar information![statusbar & config dialog](https://i.loli.net/2020/06/04/zg4W6M1bUPch2vB.jpg) diff --git a/kman.py b/kman.py index aed506f..8f516e3 100644 --- a/kman.py +++ b/kman.py @@ -64,6 +64,7 @@ CLIPPATH = './tclip.txt' OUTPREF = './clip' DEBUG = 1 # 0 - INFO; 1 - DEBUG LOG2FILE = 1 # 0 - to stdio; 1 - to file +LOGFILE = 'log' DELIMITER= '|' # log info @@ -73,7 +74,7 @@ logger = logging.getLogger() formatter = logging.Formatter('') if LOG2FILE: - handler = logging.FileHandler("log") + handler = logging.FileHandler(LOGFILE) handler.setFormatter(formatter) logger.addHandler(handler) else: @@ -110,7 +111,7 @@ def parse_section(s,i): """parse section Args: - s: section dict + s: section line list i: section index Returns: @@ -118,7 +119,7 @@ def parse_section(s,i): d = { 'bookname':bookname, bookname: { 'author':author - 'section0':{ + '0':{ 'type':'HL', 'position':'123', 'day':'2020年5月26日', diff --git a/kmanrc.py b/kmanrc.py index 325a34b..b0b1728 100644 --- a/kmanrc.py +++ b/kmanrc.py @@ -6,85 +6,86 @@ from PySide2 import QtCore qt_resource_data = b"\ -\x00\x00\x04\xcc\ +\x00\x00\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 +\xb1\xe8et\ \x00\x00\x1cx\ \x89\ PNG\x0d\x0a\x1a\x0a\x00\x00\x00\x0dIHDR\x00\ @@ -45617,84 +45618,84 @@ qt_resource_struct = b"\ \x00\x00\x00\x00\x00\x02\x00\x00\x00'\x00\x00\x00\x03\ \x00\x00\x00\x00\x00\x00\x00\x00\ \x00\x00\x00\x10\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\ -\x00\x00\x01ry\x81\xbb\x9f\ -\x00\x00\x02\xaa\x00\x00\x00\x00\x00\x01\x00\x08\x03\xa2\ +\x00\x00\x01r|\xf92\x84\ +\x00\x00\x02\xaa\x00\x00\x00\x00\x00\x01\x00\x08\x03\xab\ \x00\x00\x01ro \xc0+\ -\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x01\x00\x01l\x98\ +\x00\x00\x00\x8e\x00\x00\x00\x00\x00\x01\x00\x01l\xa1\ \x00\x00\x01rybF\xf5\ -\x00\x00\x03\x5c\x00\x00\x00\x00\x00\x01\x00\x09\xab\xb7\ +\x00\x00\x03\x5c\x00\x00\x00\x00\x00\x01\x00\x09\xab\xc0\ \x00\x00\x01ro-O\xd6\ -\x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00!L\ +\x00\x00\x00R\x00\x00\x00\x00\x00\x01\x00\x00!U\ \x00\x00\x01ryefk\ -\x00\x00\x02d\x00\x00\x00\x00\x00\x01\x00\x07\x04\xfd\ +\x00\x00\x02d\x00\x00\x00\x00\x00\x01\x00\x07\x05\x06\ \x00\x00\x01ro!\xbci\ -\x00\x00\x03\x92\x00\x00\x00\x00\x00\x01\x00\x09\xe1G\ +\x00\x00\x03\x92\x00\x00\x00\x00\x00\x01\x00\x09\xe1P\ \x00\x00\x01ro \x94\xf5\ -\x00\x00\x01\x08\x00\x00\x00\x00\x00\x01\x00\x03(\xdd\ +\x00\x00\x01\x08\x00\x00\x00\x00\x00\x01\x00\x03(\xe6\ \x00\x00\x01rn\x81\xa0K\ -\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x01\x00\x02\xbe\xac\ +\x00\x00\x00\xf0\x00\x00\x00\x00\x00\x01\x00\x02\xbe\xb5\ \x00\x00\x01rn\x7f\x9a\xa2\ -\x00\x00\x01\xfe\x00\x00\x00\x00\x00\x01\x00\x05\xfad\ +\x00\x00\x01\xfe\x00\x00\x00\x00\x00\x01\x00\x05\xfam\ \x00\x00\x01rx\xd0\xef\xa4\ -\x00\x00\x01R\x00\x00\x00\x00\x00\x01\x00\x03\xe4\x8a\ +\x00\x00\x01R\x00\x00\x00\x00\x00\x01\x00\x03\xe4\x93\ \x00\x00\x01ro&U\x86\ -\x00\x00\x02\xc0\x00\x00\x00\x00\x00\x01\x00\x08s\x9f\ +\x00\x00\x02\xc0\x00\x00\x00\x00\x00\x01\x00\x08s\xa8\ \x00\x00\x01ro'\x5c\xdd\ -\x00\x00\x03\xe0\x00\x00\x00\x00\x00\x01\x00\x0a\xdbH\ +\x00\x00\x03\xe0\x00\x00\x00\x00\x00\x01\x00\x0a\xdbQ\ \x00\x00\x01rxL\xc3L\ -\x00\x00\x01\xd0\x00\x00\x00\x00\x00\x01\x00\x05G\xaa\ +\x00\x00\x01\xd0\x00\x00\x00\x00\x00\x01\x00\x05G\xb3\ \x00\x00\x01rn\x80a\x98\ -\x00\x00\x02\x82\x00\x00\x00\x00\x00\x01\x00\x07\x1c\xca\ +\x00\x00\x02\x82\x00\x00\x00\x00\x00\x01\x00\x07\x1c\xd3\ \x00\x00\x01ro!\x10\x8b\ -\x00\x00\x00z\x00\x00\x00\x00\x00\x01\x00\x01 q\ +\x00\x00\x00z\x00\x00\x00\x00\x00\x01\x00\x01 z\ \x00\x00\x01ro6\xcc\x14\ -\x00\x00\x02\x94\x00\x00\x00\x00\x00\x01\x00\x07\x8fY\ +\x00\x00\x02\x94\x00\x00\x00\x00\x00\x01\x00\x07\x8fb\ \x00\x00\x01ryf\xd9E\ -\x00\x00\x020\x00\x00\x00\x00\x00\x01\x00\x06Q\xde\ +\x00\x00\x020\x00\x00\x00\x00\x00\x01\x00\x06Q\xe7\ \x00\x00\x01rn\x83W\xb2\ -\x00\x00\x01\xa0\x00\x00\x00\x00\x00\x01\x00\x04\xaa\xa3\ +\x00\x00\x01\xa0\x00\x00\x00\x00\x00\x01\x00\x04\xaa\xac\ \x00\x00\x01rn\x80\x8e_\ -\x00\x00\x018\x00\x00\x00\x00\x00\x01\x00\x03\xb0;\ +\x00\x00\x018\x00\x00\x00\x00\x00\x01\x00\x03\xb0D\ \x00\x00\x01ro'\xd9\xb1\ -\x00\x00\x01\xe6\x00\x00\x00\x00\x00\x01\x00\x05\x95\xb8\ +\x00\x00\x01\xe6\x00\x00\x00\x00\x00\x01\x00\x05\x95\xc1\ \x00\x00\x01ro!\x80\x9f\ -\x00\x00\x03p\x00\x00\x00\x00\x00\x01\x00\x09\xc2\x91\ +\x00\x00\x03p\x00\x00\x00\x00\x00\x01\x00\x09\xc2\x9a\ \x00\x00\x01ro*{\xa5\ -\x00\x00\x03\xc4\x00\x00\x00\x00\x00\x01\x00\x0a\xa25\ +\x00\x00\x03\xc4\x00\x00\x00\x00\x00\x01\x00\x0a\xa2>\ \x00\x00\x01rxA\xa0\xe6\ -\x00\x00\x02\x14\x00\x00\x00\x00\x00\x01\x00\x06. \ +\x00\x00\x02\x14\x00\x00\x00\x00\x00\x01\x00\x06.)\ \x00\x00\x01ro'\xf7\xd9\ -\x00\x00\x01\x80\x00\x00\x00\x00\x00\x01\x00\x04KO\ +\x00\x00\x01\x80\x00\x00\x00\x00\x00\x01\x00\x04KX\ \x00\x00\x01ro+U:\ -\x00\x00\x000\x00\x00\x00\x00\x00\x01\x00\x00\x04\xd0\ +\x00\x00\x000\x00\x00\x00\x00\x00\x01\x00\x00\x04\xd9\ \x00\x00\x01ro\x22L\x9b\ -\x00\x00\x00\xba\x00\x00\x00\x00\x00\x01\x00\x02+n\ +\x00\x00\x00\xba\x00\x00\x00\x00\x00\x01\x00\x02+w\ \x00\x00\x01rn\x80\xbaA\ -\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x01\x00\x02w\x1c\ +\x00\x00\x00\xd4\x00\x00\x00\x00\x00\x01\x00\x02w%\ \x00\x00\x01ro\x14<\x9f\ -\x00\x00\x02\xdc\x00\x00\x00\x00\x00\x01\x00\x08\x94N\ +\x00\x00\x02\xdc\x00\x00\x00\x00\x00\x01\x00\x08\x94W\ \x00\x00\x01ro\x14\xa8\xb6\ -\x00\x00\x00f\x00\x00\x00\x00\x00\x01\x00\x00\x9a\x98\ +\x00\x00\x00f\x00\x00\x00\x00\x00\x01\x00\x00\x9a\xa1\ \x00\x00\x01ro\x1e\xc7F\ -\x00\x00\x03,\x00\x00\x00\x00\x00\x01\x00\x09_\xa9\ +\x00\x00\x03,\x00\x00\x00\x00\x00\x01\x00\x09_\xb2\ \x00\x00\x01rxK\x8a\x1d\ -\x00\x00\x01\xbc\x00\x00\x00\x00\x00\x01\x00\x04\xf5\x99\ +\x00\x00\x01\xbc\x00\x00\x00\x00\x00\x01\x00\x04\xf5\xa2\ \x00\x00\x01ro!G\x15\ -\x00\x00\x01 \x00\x00\x00\x00\x00\x01\x00\x03\x90\x1e\ +\x00\x00\x01 \x00\x00\x00\x00\x00\x01\x00\x03\x90'\ \x00\x00\x01ro*\xb4%\ -\x00\x00\x02\xf6\x00\x00\x00\x00\x00\x01\x00\x08\x9d\xe8\ +\x00\x00\x02\xf6\x00\x00\x00\x00\x00\x01\x00\x08\x9d\xf1\ \x00\x00\x01ryaf\xee\ -\x00\x00\x02J\x00\x00\x00\x00\x00\x01\x00\x06\x9f\xa6\ +\x00\x00\x02J\x00\x00\x00\x00\x00\x01\x00\x06\x9f\xaf\ \x00\x00\x01ryg+\xf0\ -\x00\x00\x03\xaa\x00\x00\x00\x00\x00\x01\x00\x0a?]\ +\x00\x00\x03\xaa\x00\x00\x00\x00\x00\x01\x00\x0a?f\ \x00\x00\x01rx\xcbU\xa4\ -\x00\x00\x03H\x00\x00\x00\x00\x00\x01\x00\x09\x84&\ +\x00\x00\x03H\x00\x00\x00\x00\x00\x01\x00\x09\x84/\ \x00\x00\x01rx\xcc\xdf'\ -\x00\x00\x01h\x00\x00\x00\x00\x00\x01\x00\x04\x00{\ +\x00\x00\x01h\x00\x00\x00\x00\x00\x01\x00\x04\x00\x84\ \x00\x00\x01rn\x80\xf2c\ -\x00\x00\x03\x10\x00\x00\x00\x00\x00\x01\x00\x08\xf4W\ +\x00\x00\x03\x10\x00\x00\x00\x00\x00\x01\x00\x08\xf4`\ \x00\x00\x01ro!-\x86\ -\x00\x00\x00\xa6\x00\x00\x00\x00\x00\x01\x00\x01\xbd\xb7\ +\x00\x00\x00\xa6\x00\x00\x00\x00\x00\x01\x00\x01\xbd\xc0\ \x00\x00\x01rn\x7f\xe8!\ " diff --git a/mainwindow.py b/mainwindow.py index d193e30..0d302b3 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -149,10 +149,11 @@ class Ui_MainWindow(object): self.toolBar.addAction(self.actionimportkindle) self.toolBar.addAction(self.actionimportlocal) self.toolBar.addSeparator() - self.toolBar.addAction(self.actionconfig) self.toolBar.addAction(self.actionwords) self.toolBar.addAction(self.actionstatistic) self.toolBar.addSeparator() + self.toolBar.addAction(self.actionconfig) + self.toolBar.addSeparator() self.toolBar.addAction(self.actionhomepage) self.toolBar.addAction(self.actionabout) self.toolBar.addSeparator() @@ -177,9 +178,9 @@ class Ui_MainWindow(object): #if QT_CONFIG(tooltip) self.actionconfig.setToolTip(QCoreApplication.translate("MainWindow", u"configuration", None)) #endif // QT_CONFIG(tooltip) - self.actionflush.setText(QCoreApplication.translate("MainWindow", u"flush", None)) + self.actionflush.setText(QCoreApplication.translate("MainWindow", u"refresh", None)) #if QT_CONFIG(tooltip) - self.actionflush.setToolTip(QCoreApplication.translate("MainWindow", u"flush import file", None)) + self.actionflush.setToolTip(QCoreApplication.translate("MainWindow", u"refresh import file/quick import from kindle", None)) #endif // QT_CONFIG(tooltip) self.actionwords.setText(QCoreApplication.translate("MainWindow", u"words", None)) #if QT_CONFIG(tooltip) diff --git a/mainwindow.ui b/mainwindow.ui index 1bf3d1b..d5466fe 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -117,10 +117,11 @@ - + + diff --git a/searchtitle.md b/searchtitle.md index 60a4f4e..3727ac9 100644 --- a/searchtitle.md +++ b/searchtitle.md @@ -1,3 +1,6 @@ TYPE|BOOKNAME|AUTHOR|MARKTIME|CONTENT --|--|--|--|-- HL|薛兆丰经济学讲义 |薛兆丰|2020/1/13 8:11:05|么到底什么叫边际?边际就是“新增”带来的“新增”。 例如,边际成本就是每新增一个单位产品所需要付出的新增成本;边际收入是每多卖一个产品能够带来的新增收入;边际产量是每新增一份投入所带来的新增产量;边际效用是每消耗一个单位的商品所能带来的新增享受。 +HL|薛兆丰经济学讲义 |薛兆丰|2020/1/30 10:23:58|一个国家很大,贫富有差距,并非每个学校和家长都能负担得起这样标准的校车。标准太高,就会逼着很多学校,尤其是农村的学校放弃提供校车,家长们就只能使用安全性能更低的交通工具,比如自己骑自行车或雇用黑车等,结果是孩子们享受到的安全保障反而降低了。 +NT|薛兆丰经济学讲义 |薛兆丰|2020/1/30 10:26:31|山寨 假货 问题 +HL|薛兆丰经济学讲义 |薛兆丰|2020/1/30 10:29:41|为了克服信息不对称,建立互信,人类社会构想出了各种各样有趣的解决方案,从重复交易到第三方背书,从质保、延保,再到收益共享。此外,还有三种非常接近的建立信任的办法:付出沉没成本、给出人质或者给出抵押。 diff --git a/tclip.txt b/tclip.txt index 9fe2af8..9a8dad3 100755 --- a/tclip.txt +++ b/tclip.txt @@ -8,3 +8,18 @@ 么到底什么叫边际?边际就是“新增”带来的“新增”。 例如,边际成本就是每新增一个单位产品所需要付出的新增成本;边际收入是每多卖一个产品能够带来的新增收入;边际产量是每新增一份投入所带来的新增产量;边际效用是每消耗一个单位的商品所能带来的新增享受。 ========== +薛兆丰经济学讲义 (薛兆丰) +- 您在位置 #4284-4286的标注 | 添加于 2020年1月30日星期四 上午10:23:58 + +一个国家很大,贫富有差距,并非每个学校和家长都能负担得起这样标准的校车。标准太高,就会逼着很多学校,尤其是农村的学校放弃提供校车,家长们就只能使用安全性能更低的交通工具,比如自己骑自行车或雇用黑车等,结果是孩子们享受到的安全保障反而降低了。 +========== +薛兆丰经济学讲义 (薛兆丰) +- 您在位置 #4286 的笔记 | 添加于 2020年1月30日星期四 上午10:26:31 + +山寨 假货 问题 +========== +薛兆丰经济学讲义 (薛兆丰) +- 您在位置 #4382-4384的标注 | 添加于 2020年1月30日星期四 上午10:29:41 + +为了克服信息不对称,建立互信,人类社会构想出了各种各样有趣的解决方案,从重复交易到第三方背书,从质保、延保,再到收益共享。此外,还有三种非常接近的建立信任的办法:付出沉没成本、给出人质或者给出抵押。 +========== diff --git a/test_kman.py b/test_kman.py new file mode 100644 index 0000000..3ef8c5a --- /dev/null +++ b/test_kman.py @@ -0,0 +1,161 @@ + +import unittest + +from collections import defaultdict + +from kman import * + +class TestKman(unittest.TestCase): + # initial + def setUp(self): + CLIPPATH = './test.data' + OUTPREF = './test.clip' + LOG2FILE = 1 + DELIMITER= '|' + + global t_bm_sec + global t_hl_sec + global t_nt_sec + global t_books + t_bm_sec = ["""另一半中国史 (高洪雷) """, \ + """- 您在位置 #2468 的书签 | 添加于 2020年1月12日星期日 下午11:09:06 """] + t_hl_sec = ["""薛兆丰经济学讲义 (薛兆丰) """, \ + """- 您在位置 #1408-1410的标注 | 添加于 2020年1月13日星期一 上午8:11:05 """, \ + """边际就是“新增”带来的“新增”。 """] + t_nt_sec = ["""薛兆丰经济学讲义 (薛兆丰) """, \ + """- 您在位置 #4286 的笔记 | 添加于 2020年1月30日星期四 下午10:26:31 """, \ + """山寨 假货 问题 """] + t_books = defaultdict(dict) + + def cre_tbooks(self): + # parsing section & fill data structure + t_secd = parse_section(t_bm_sec,0) + + t_secd = parse_section(t_hl_sec,1) + bn = t_secd['bookname'] + t_books[bn]['author'] = t_secd[bn]['author'] + t_books[bn]['1'] = t_secd[bn]['1'] + t_secd.clear() + + t_secd = parse_section(t_nt_sec,2) + bn = t_secd['bookname'] + t_books[bn]['author'] = t_secd[bn]['author'] + t_books[bn]['2'] = t_secd[bn]['2'] + t_secd.clear() + + return t_books + + # test function parse_section + def test_parse_section(self): + # parsing section & fill data structure + t_secd = parse_section(t_bm_sec,0) + self.assertEqual(t_secd,False) + + t_secd = parse_section(t_hl_sec,1) + bn = t_secd['bookname'] + self.assertIsNotNone(t_secd) + self.assertEqual(bn,'薛兆丰经济学讲义 ') + self.assertEqual(t_secd[bn]['author'],'薛兆丰') + self.assertEqual(t_secd[bn]['1']['type'],'HL') + self.assertEqual(t_secd[bn]['1']['position'],'1408-1410') + self.assertEqual(t_secd[bn]['1']['day'],'2020年1月13日') + self.assertEqual(t_secd[bn]['1']['week'],'星期一') + self.assertEqual(t_secd[bn]['1']['meridiem'],'上午') + self.assertEqual(t_secd[bn]['1']['time'],'8:11:05') + self.assertEqual(t_secd[bn]['1']['content'],'边际就是“新增”带来的“新增”。\n') + t_books[bn]['author'] = t_secd[bn]['author'] + t_books[bn]['1'] = t_secd[bn]['1'] + t_secd.clear() + + t_secd = parse_section(t_nt_sec,2) + bn = t_secd['bookname'] + self.assertIsNotNone(t_secd) + self.assertEqual(bn,'薛兆丰经济学讲义 ') + self.assertEqual(t_secd[bn]['author'],'薛兆丰') + self.assertEqual(t_secd[bn]['2']['type'],'NT') + self.assertEqual(t_secd[bn]['2']['position'],'4286') + self.assertEqual(t_secd[bn]['2']['day'],'2020年1月30日') + self.assertEqual(t_secd[bn]['2']['week'],'星期四') + self.assertEqual(t_secd[bn]['2']['meridiem'],'下午') + self.assertEqual(t_secd[bn]['2']['time'],'10:26:31') + self.assertEqual(t_secd[bn]['2']['content'],'山寨 假货 问题\n') + t_books[bn]['author'] = t_secd[bn]['author'] + t_books[bn]['2'] = t_secd[bn]['2'] + t_secd.clear() + + # test drop_duplicate + def test_drop_duplicate(self): + t_books = self.cre_tbooks() + t_secd = parse_section(t_hl_sec,3) + bn = t_secd['bookname'] + t_books_du = t_books.copy() + t_books_du[bn]['3'] = t_secd[bn]['3'] + t_books_du[bn]['4'] = t_secd[bn]['3'] + self.assertIsInstance(t_books_du[bn]['3'],dict) + + try: + t_books_du = drop_duplicate(t_books_du) + t = t_books_du[bn]['3'] + except KeyError as keyerror: + print("与预期匹配,sidx 3 重复被删除,抛出: %s" % 'keyerror') + + t_secd.clear() + + # test function format_time() + def test_format_time(self): + t_ds = '2020年1月13日 星期一 下午 8:11:05' + t_ds = format_time(t_ds) + self.assertEqual(t_ds, '2020/1/13 20:11:05') + + # test function format_data + def test_format_data(self): + t_books = self.cre_tbooks() + t_out = format_data(t_books, ft='MD') + self.assertEqual(t_out[0], 'TYPE|BOOKNAME|AUTHOR|MARKTIME|CONTENT') + self.assertEqual(t_out[1], '--|--|--|--|--') + self.assertEqual(t_out[2], 'HL|薛兆丰经济学讲义 |薛兆丰|2020/1/13 8:11:05|边际就是“新增”带来的“新增”。\n') + t_out.clear() + + + def test_add_note_to_highlight(self): + t_books = self.cre_tbooks() + t_books_remove_nt = add_note_to_highlight(t_books) + for k in t_books_remove_nt.keys(): + bn = k + self.assertEqual((t_books_remove_nt[bn]['1']['content']).replace('\n',''),\ + '边际就是“新增”带来的“新增”。'+NTPREF+ '山寨 假货 问题') + + """ + def test_search_clip(self): + pass + def test_statistic(self): + pass + def test_dict2json(self): + pass + def test_json2dict(self): + pass + def test_import_clips(self): + pass + """ + + # clean + def tearDown(self): + pass + +if __name__ == '__main__': + + """ + suite = unittest.TestSuite () + suite.addTest(TestKman('test_parse_section')) + suite.addTest(TestKman('test_format_time')) + suite.addTest(TestKman('test_format_data')) + suite.addTest(TestKman('test_drop_duplicate')) + suite.addTest(TestKman('test_add_note_to_highlight')) + run = unittest.TextTestRunner (verbosity=2) + run.run (suite) + """ + + # not callable sequency + unittest.main() + + diff --git a/xx b/xx index f91e546..925c5fd 100644 --- a/xx +++ b/xx @@ -1 +1 @@ -{"\u859b\u5146\u4e30\u7ecf\u6d4e\u5b66\u8bb2\u4e49 ": {"author": "\u859b\u5146\u4e30", "1": {"type": "HL", "position": "1408-1410", "day": "2020\u5e741\u670813\u65e5", "week": "\u661f\u671f\u4e00", "meridiem": "\u4e0a\u5348", "time": "8:11:05", "content": "\u4e48\u5230\u5e95\u4ec0\u4e48\u53eb\u8fb9\u9645\uff1f\u8fb9\u9645\u5c31\u662f\u201c\u65b0\u589e\u201d\u5e26\u6765\u7684\u201c\u65b0\u589e\u201d\u3002 \u4f8b\u5982\uff0c\u8fb9\u9645\u6210\u672c\u5c31\u662f\u6bcf\u65b0\u589e\u4e00\u4e2a\u5355\u4f4d\u4ea7\u54c1\u6240\u9700\u8981\u4ed8\u51fa\u7684\u65b0\u589e\u6210\u672c\uff1b\u8fb9\u9645\u6536\u5165\u662f\u6bcf\u591a\u5356\u4e00\u4e2a\u4ea7\u54c1\u80fd\u591f\u5e26\u6765\u7684\u65b0\u589e\u6536\u5165\uff1b\u8fb9\u9645\u4ea7\u91cf\u662f\u6bcf\u65b0\u589e\u4e00\u4efd\u6295\u5165\u6240\u5e26\u6765\u7684\u65b0\u589e\u4ea7\u91cf\uff1b\u8fb9\u9645\u6548\u7528\u662f\u6bcf\u6d88\u8017\u4e00\u4e2a\u5355\u4f4d\u7684\u5546\u54c1\u6240\u80fd\u5e26\u6765\u7684\u65b0\u589e\u4eab\u53d7\u3002"}, "lines": 1}} \ No newline at end of file +{"\u859b\u5146\u4e30\u7ecf\u6d4e\u5b66\u8bb2\u4e49 ": {"author": "\u859b\u5146\u4e30", "1": {"type": "HL", "position": "1408-1410", "day": "2020\u5e741\u670813\u65e5", "week": "\u661f\u671f\u4e00", "meridiem": "\u4e0a\u5348", "time": "8:11:05", "content": "\u4e48\u5230\u5e95\u4ec0\u4e48\u53eb\u8fb9\u9645\uff1f\u8fb9\u9645\u5c31\u662f\u201c\u65b0\u589e\u201d\u5e26\u6765\u7684\u201c\u65b0\u589e\u201d\u3002 \u4f8b\u5982\uff0c\u8fb9\u9645\u6210\u672c\u5c31\u662f\u6bcf\u65b0\u589e\u4e00\u4e2a\u5355\u4f4d\u4ea7\u54c1\u6240\u9700\u8981\u4ed8\u51fa\u7684\u65b0\u589e\u6210\u672c\uff1b\u8fb9\u9645\u6536\u5165\u662f\u6bcf\u591a\u5356\u4e00\u4e2a\u4ea7\u54c1\u80fd\u591f\u5e26\u6765\u7684\u65b0\u589e\u6536\u5165\uff1b\u8fb9\u9645\u4ea7\u91cf\u662f\u6bcf\u65b0\u589e\u4e00\u4efd\u6295\u5165\u6240\u5e26\u6765\u7684\u65b0\u589e\u4ea7\u91cf\uff1b\u8fb9\u9645\u6548\u7528\u662f\u6bcf\u6d88\u8017\u4e00\u4e2a\u5355\u4f4d\u7684\u5546\u54c1\u6240\u80fd\u5e26\u6765\u7684\u65b0\u589e\u4eab\u53d7\u3002"}, "2": {"type": "HL", "position": "4284-4286", "day": "2020\u5e741\u670830\u65e5", "week": "\u661f\u671f\u56db", "meridiem": "\u4e0a\u5348", "time": "10:23:58", "content": "\u4e00\u4e2a\u56fd\u5bb6\u5f88\u5927\uff0c\u8d2b\u5bcc\u6709\u5dee\u8ddd\uff0c\u5e76\u975e\u6bcf\u4e2a\u5b66\u6821\u548c\u5bb6\u957f\u90fd\u80fd\u8d1f\u62c5\u5f97\u8d77\u8fd9\u6837\u6807\u51c6\u7684\u6821\u8f66\u3002\u6807\u51c6\u592a\u9ad8\uff0c\u5c31\u4f1a\u903c\u7740\u5f88\u591a\u5b66\u6821\uff0c\u5c24\u5176\u662f\u519c\u6751\u7684\u5b66\u6821\u653e\u5f03\u63d0\u4f9b\u6821\u8f66\uff0c\u5bb6\u957f\u4eec\u5c31\u53ea\u80fd\u4f7f\u7528\u5b89\u5168\u6027\u80fd\u66f4\u4f4e\u7684\u4ea4\u901a\u5de5\u5177\uff0c\u6bd4\u5982\u81ea\u5df1\u9a91\u81ea\u884c\u8f66\u6216\u96c7\u7528\u9ed1\u8f66\u7b49\uff0c\u7ed3\u679c\u662f\u5b69\u5b50\u4eec\u4eab\u53d7\u5230\u7684\u5b89\u5168\u4fdd\u969c\u53cd\u800c\u964d\u4f4e\u4e86\u3002--CG\u6ce8:\u5c71\u5be8 \u5047\u8d27 \u95ee\u9898"}, "4": {"type": "HL", "position": "4382-4384", "day": "2020\u5e741\u670830\u65e5", "week": "\u661f\u671f\u56db", "meridiem": "\u4e0a\u5348", "time": "10:29:41", "content": "\u4e3a\u4e86\u514b\u670d\u4fe1\u606f\u4e0d\u5bf9\u79f0\uff0c\u5efa\u7acb\u4e92\u4fe1\uff0c\u4eba\u7c7b\u793e\u4f1a\u6784\u60f3\u51fa\u4e86\u5404\u79cd\u5404\u6837\u6709\u8da3\u7684\u89e3\u51b3\u65b9\u6848\uff0c\u4ece\u91cd\u590d\u4ea4\u6613\u5230\u7b2c\u4e09\u65b9\u80cc\u4e66\uff0c\u4ece\u8d28\u4fdd\u3001\u5ef6\u4fdd\uff0c\u518d\u5230\u6536\u76ca\u5171\u4eab\u3002\u6b64\u5916\uff0c\u8fd8\u6709\u4e09\u79cd\u975e\u5e38\u63a5\u8fd1\u7684\u5efa\u7acb\u4fe1\u4efb\u7684\u529e\u6cd5\uff1a\u4ed8\u51fa\u6c89\u6ca1\u6210\u672c\u3001\u7ed9\u51fa\u4eba\u8d28\u6216\u8005\u7ed9\u51fa\u62b5\u62bc\u3002"}, "lines": 4}} \ No newline at end of file