From 3a44e0f3ac115983882e9dfa799464fb9ca9e927 Mon Sep 17 00:00:00 2001 From: jacky_cai Date: Wed, 2 Jun 2021 02:22:34 -0700 Subject: [PATCH] Update, --- PS文件/群/QUN062A袁谭.png | 4 +- PS文件/群/QUN062A袁谭.psd | 4 +- PS文件/群/QUN062B袁尚.png | 4 +- PS文件/群/QUN062B袁尚.psd | 4 +- PS文件/群/QUN062C袁熙.png | 4 +- PS文件/群/QUN062C袁熙.psd | 4 +- PS文件/魏/WEI039钟繇.png | 4 +- PS文件/魏/WEI039钟繇.psd | 4 +- PS文件/魏/WEI075蒋干.png | 4 +- PS文件/魏/WEI075蒋干.psd | 4 +- README.md | 23 +++++-- 脚本/sgs_card_image_update.py | 111 ++++++++++++++++++++++++++++++++++ 12 files changed, 148 insertions(+), 26 deletions(-) create mode 100644 脚本/sgs_card_image_update.py diff --git a/PS文件/群/QUN062A袁谭.png b/PS文件/群/QUN062A袁谭.png index 93ec4f9..47e30d3 100644 --- a/PS文件/群/QUN062A袁谭.png +++ b/PS文件/群/QUN062A袁谭.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1cf1d98516358f698af9f5c3d2e8d25bf8478f64aaeff7c7fec8f6bc811bdc8b -size 1597418 +oid sha256:1fa71e1852224a649a0a928011cd0ad85e07a4e28f6766412cf15f8df9a8409d +size 1595386 diff --git a/PS文件/群/QUN062A袁谭.psd b/PS文件/群/QUN062A袁谭.psd index 2adaaae..b5bf171 100644 --- a/PS文件/群/QUN062A袁谭.psd +++ b/PS文件/群/QUN062A袁谭.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ed72de1872fd74d32e20fcffe0c01d87a7e7913fedd79048a2748e09e0add109 -size 29816233 +oid sha256:72ad39099440a086a9e0a393a98eadb1010ce12e12e321d4f133a0a687ef2b3b +size 29810437 diff --git a/PS文件/群/QUN062B袁尚.png b/PS文件/群/QUN062B袁尚.png index 5cb4004..cbce03f 100644 --- a/PS文件/群/QUN062B袁尚.png +++ b/PS文件/群/QUN062B袁尚.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9dd6f902b953a5bcca41f94c99039f832e63a01e98c49dcc10b2d641f816852c -size 1632311 +oid sha256:354c06f4af0272104ae483ee839ed908ebdd471c37442643a28ab5709d1d90c2 +size 1633439 diff --git a/PS文件/群/QUN062B袁尚.psd b/PS文件/群/QUN062B袁尚.psd index ccc7d83..666c7ef 100644 --- a/PS文件/群/QUN062B袁尚.psd +++ b/PS文件/群/QUN062B袁尚.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:643c0fb037ad8520f927709410a3fe2a6653be1423b232831d71fae21ae27cdb -size 29841996 +oid sha256:8d3296ba4907fd008a67469be11a087e58bed4721e226389de2d362bd259b80d +size 29842892 diff --git a/PS文件/群/QUN062C袁熙.png b/PS文件/群/QUN062C袁熙.png index 1327eeb..232f138 100644 --- a/PS文件/群/QUN062C袁熙.png +++ b/PS文件/群/QUN062C袁熙.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dc194c416b61f439572f69d5007e023bd35b813f91a5f54c600ad04d5115c92e -size 1426282 +oid sha256:68469f6f62a47a6e8d4208475458dc29acb8555ab6957fad0b17b26c189a2ec0 +size 1427418 diff --git a/PS文件/群/QUN062C袁熙.psd b/PS文件/群/QUN062C袁熙.psd index 2930d53..1b630dd 100644 --- a/PS文件/群/QUN062C袁熙.psd +++ b/PS文件/群/QUN062C袁熙.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c6f3842907ec106d5a3efc98d8c8694de5368bf513ab55aa7f50c2489c539e05 -size 34538483 +oid sha256:0e69ba55fa435b9a155e4adc92350419963b5bf3d043124eb075bcbab96fff30 +size 34540733 diff --git a/PS文件/魏/WEI039钟繇.png b/PS文件/魏/WEI039钟繇.png index bdbb3b7..c950e3f 100644 --- a/PS文件/魏/WEI039钟繇.png +++ b/PS文件/魏/WEI039钟繇.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1f67eac8868713dcac586ce5266654a302b55dc4750f9fe76c21fcf5564d3ce0 -size 1444626 +oid sha256:a01d3223ce3c54a39399b827ba1f76c5365becd7e6fb1bb301df1807db9bf4d7 +size 1447230 diff --git a/PS文件/魏/WEI039钟繇.psd b/PS文件/魏/WEI039钟繇.psd index 2f20173..9a4d00b 100644 --- a/PS文件/魏/WEI039钟繇.psd +++ b/PS文件/魏/WEI039钟繇.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e13770f936a03fd1fc66ee592f2dc0baee6cae6a5334c8f96e0e577994992a11 -size 25533377 +oid sha256:4029dcee31ba422625592bcc0662fa9fda43dc256bdaa34a3c82555a8eeab8fa +size 25541402 diff --git a/PS文件/魏/WEI075蒋干.png b/PS文件/魏/WEI075蒋干.png index dd8397b..170dbb4 100644 --- a/PS文件/魏/WEI075蒋干.png +++ b/PS文件/魏/WEI075蒋干.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6d46cb7a6a12a263300d3af3ba08528f53b016c2039f9e84f5be9e90650c4b93 -size 1678793 +oid sha256:3689d9acf3463eb422f628a97e2687789958dfa82e6d48425c33d9432ec62aa7 +size 1680130 diff --git a/PS文件/魏/WEI075蒋干.psd b/PS文件/魏/WEI075蒋干.psd index 4f8c725..4f8590f 100644 --- a/PS文件/魏/WEI075蒋干.psd +++ b/PS文件/魏/WEI075蒋干.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1624c691d7152f7a7ccbe4ba14485321efc4623bdef9081cd0d4a0bd8a2adde0 -size 25182046 +oid sha256:d7ac516aaad32c461d7d0b0114fa956d5ebffa329ebc6a29a44c797824f6d64f +size 25179831 diff --git a/README.md b/README.md index 41ffd4f..a3e1fec 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,17 @@ TTS老将: 老孙权,刘瑶 ### 2020/05/30 +吴苋: 应当是打出也能发动技能。 +钟繇: 活了! +蒋干: 偷偷。 +吴庞统: 得香蕉。 打印区暂无。 +老孙权: 咸鸡8人局。 +雷铜: 乌龟大哥。 +吴兰: 乌龟小弟。 +管辂: 梭哈能力上升。 +郭女王: 女王大人。 + + 顾雍: 方块。 郭淮: 打出也能发动。魏晋。 马云禄: 描述错误。 @@ -51,7 +62,7 @@ TTS老将: 老孙权,刘瑶 杜预: 灭吴设计。 吕范: 防御能力。 鲁肃: 好释特别好释。 - +荀攸: 不能被响应。 ### 2020/05/21 大聪明: 描述调整。技能分离,可选择。 @@ -60,11 +71,11 @@ TTS老将: 老孙权,刘瑶 马云禄: 疯婆光环。 伊籍: 首次条件。 SB马超: 杀死则回复。 -陈武董袭: X为1 +陈武董袭: X为1 吕蒙: 克己。 -蒋琬费祎: 生啊生。 +蒋琬费祎: 生啊生。 -龙渊: ! +刘辨: 好恨。 司马昭: 推弑描述更新。 邓艾: 按次??????????? 凌操: 肚子冲锋! @@ -77,7 +88,7 @@ SB马超: 杀死则回复。 曹操: 出牌阶段时机明确。 张让: 未以此法使用。 王基: 时间。 -刘辨: 好恨。 + 群徐晃: 好玩。 公孙康: 不能连环献头。 袁尚: 太猛。勇力削弱。 @@ -193,7 +204,7 @@ SB马超: 杀死则回复。 廖化: 插画。 魏关羽: 描述简化。 吴庞统: 描述简化。 -赵统赵广: 描述简化。 +赵统赵广: 描述简化。 李肃: 还珠子描述。 庞统诸葛亮: 三策。 diff --git a/脚本/sgs_card_image_update.py b/脚本/sgs_card_image_update.py new file mode 100644 index 0000000..ee4f7b3 --- /dev/null +++ b/脚本/sgs_card_image_update.py @@ -0,0 +1,111 @@ +import requests +import urllib +import urllib.request +import mimetypes +from bs4 import BeautifulSoup +from requests.adapters import HTTPAdapter +from requests.packages.urllib3.util.retry import Retry +import re +import json +import ast + +custom_deck_string = "" +ContainedObjects = "" +custom_deck_count = 1 +back_url = "https://git.iidx.ca/aquostics/VancouverSanguosha.git/info/lfs/objects/1ba1832950a60b45a7b5d98147a1cc07d75ecf53ced1b8489c5a74169cbfb65d/6LWb5a6B5qih5p2_6IOM6Z2iLnBuZw" +last_part = "', 'NumWidth': 1, 'NumHeight': 1, 'BackIsHidden': True, 'UniqueBack': False, 'Type': 0}" +start_part = "'" +custom_deck_str_array = [] +info_array = [] +name_array = [] + + +def dumper(obj): + try: + return obj.toJSON() + except: + return obj.__dict__ + + +def find_chinese(file): + pattern = re.compile(r'[^\u4e00-\u9fa5]') + chinese = re.sub(pattern, '', file) + return chinese + + +def find_heroes_images(country): + info = country.find('a') + string = "https://git.iidx.ca/" + str(info.get('href')) + country_name = str(info.get('title')) + print('==================================== 开始抓取%s势力图链 ====================================\n' % str(country_name)) + url = requests.get(string) + html = url.text + soup = BeautifulSoup(html, 'html.parser') + tags = soup.find_all('a') + + for tag in tags: + text = tag.text + href = tag.get('href') + if text.endswith("png"): + hero_url = requests.get("https://git.iidx.ca/" + href) + heroes_soup = BeautifulSoup(hero_url.text, 'html.parser') + heroes_images = heroes_soup.find_all('img') + + global custom_deck_string + global custom_deck_count + global back_url + global last_part + global start_part + global info_array + global name_array + + for i in heroes_images: + img_src = i.get('src') + if img_src.startswith('https://git.iidx.ca/aquostics/VancouverSanguosha.git/info/lfs/objects'): + info_array.append({"FaceURL": img_src, "BackURL": back_url, "NumWidth": 1, "NumHeight": 1, + "BackIsHidden": True, "UniqueBack": False, "Type": 0}) + + heroes_name = heroes_soup.find_all('span', attrs={'class': 'active section'}) + for i in heroes_name: + name = i.get('title') + name_array.append(str(country_name) + " " + find_chinese(name)) + + print('==================================== %s势力图链抓取完毕 ====================================\n' % str(country_name)) + + +def go_through_country(): + url = requests.get( + 'https://git.iidx.ca/aquostics/VancouverSanguosha/src/branch/master/PS%e6%96%87%e4%bb%b6') + html = url.text + soup = BeautifulSoup(html, 'html.parser') + # countries = soup.find_all('td', attrs={'class': 'name four wide'}) + countries = soup.find_all('td', {"name four wide"}) + for country in countries: + find_heroes_images(country) + + print('==================================== 全势力图链抓取完毕 ====================================\n') + + +go_through_country() + +with open('武将牌堆.json', 'r', encoding="utf-8") as f: + data = json.load(f) + index = 1 + custom_decks = {} + data['ObjectStates'][0]['DeckIDs'] = [] + for card in data['ObjectStates'][0]['ContainedObjects']: + custom_deck = {str(index): info_array[index - 1]} + card['CustomDeck'] = custom_deck + card["CardID"] = index * 100 + card['Nickname'] = name_array[index - 1] + card['HideWhenFaceDown'] = True + custom_decks[str(index)] = info_array[index - 1] + data['ObjectStates'][0]['DeckIDs'].append(index * 100) + index += 1 + + data['ObjectStates'][0]['CustomDeck'] = custom_decks + +with open('武将牌堆.json', 'w', encoding="utf-8") as f: + f.write(json.dumps(data, default=dumper, indent=2, ensure_ascii=False)) + +f.close()