From 725b96aa7e06519ff63f0edcd0fc7f744836a964 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Mon, 1 Apr 2024 16:49:20 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E8=BF=87rssMode=E6=9D=A5=E9=85=8D?= =?UTF-8?q?=E7=BD=AERSS=E8=BE=93=E5=87=BA=E7=AC=AC=E4=B8=80=E5=8F=A5?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E5=85=A8=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rssMode默认配置为sentence,可以配置为all --- Gmeek.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Gmeek.py b/Gmeek.py index a701169..9ed1474 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -70,7 +70,7 @@ class GMEEK(): os.mkdir(self.post_dir) def defaultConfig(self): - dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8} + dconfig={"singlePage":[],"startSite":"","filingNum":"","onePageListNum":15,"commentLabelColor":"#006b75","yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"],"i18n":"CN","dayTheme":"light","nightTheme":"dark","urlMode":"pinyin","script":"","style":"","bottomText":"","showPostSource":1,"iconList":{},"UTC":+8,"rssMode":"sentence"} config=json.loads(open('config.json', 'r', encoding='utf-8').read()) self.blogBase={**dconfig,**config}.copy() self.blogBase["postListJson"]=json.loads('{}') @@ -283,15 +283,20 @@ class GMEEK(): self.blogBase[listJsonName][postNum]["postSourceUrl"]="https://github.com/"+options.repo_name+"/issues/"+str(issue.number) self.blogBase[listJsonName][postNum]["commentNum"]=issue.get_comments().totalCount self.blogBase[listJsonName][postNum]["wordCount"]=len(issue.body) - if self.blogBase["i18n"]=="CN": - period="。" - else: - period="." if issue.body==None: self.blogBase[listJsonName][postNum]["description"]='' else: - self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period + if self.blogBase["rssMode"]=="sentence": + if self.blogBase["i18n"]=="CN": + period="。" + else: + period="." + self.blogBase[listJsonName][postNum]["description"]=issue.body.split(period)[0]+period + elif self.blogBase["rssMode"]=="all": + self.blogBase[listJsonName][postNum]["description"]=issue.body + else: + self.blogBase[listJsonName][postNum]["description"]='' self.blogBase[listJsonName][postNum]["top"]=0 for event in issue.get_events():