From 4468de6f7a3084ea173f65bbd22a0d734997688e Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Tue, 14 Dec 2021 21:56:52 +0800 Subject: [PATCH 1/3] update badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index bdd47e6..3bec10f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,9 @@ [![pypi](https://badgen.net/pypi/v/nonebot-bison)](https://pypi.org/project/nonebot-bison/) +[![license](https://img.shields.io/github/license/felinae98/nonebot-bison)](https://github.com/felinae98/nonebot-bison/blob/main/LICENSE) [![felinae98](https://circleci.com/gh/felinae98/nonebot-bison.svg?style=shield)](https://circleci.com/gh/felinae98/nonebot-bison) +[![docker](https://img.shields.io/docker/image-size/felinae98/nonebot-bison)](https://hub.docker.com/r/felinae98/nonebot-bison) [![qq group](https://img.shields.io/badge/QQ%E7%BE%A4-868610060-orange )](https://qm.qq.com/cgi-bin/qm/qr?k=pXYMGB_e8b6so3QTqgeV6lkKDtEeYE4f&jump_from=webapi) [文档](https://nonebot-bison.vercel.app)|[开发文档](https://nonebot-bison.vercel.app/dev) From 3f906f7a41a8fb455597a9189b588f258731447c Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Fri, 24 Dec 2021 14:20:05 +0800 Subject: [PATCH 2/3] update threshold for image merge --- src/plugins/nonebot_bison/post.py | 2 +- tests/test_merge_pic.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/plugins/nonebot_bison/post.py b/src/plugins/nonebot_bison/post.py index 9ef1136..8a77a3d 100644 --- a/src/plugins/nonebot_bison/post.py +++ b/src/plugins/nonebot_bison/post.py @@ -42,7 +42,7 @@ class Post: return Image.open(pic_buffer) def _check_image_square(self, size: tuple[int, int]) -> bool: - return abs(size[0] - size[1]) / size[0] < 0.01 + return abs(size[0] - size[1]) / size[0] < 0.05 async def _pic_merge(self) -> None: if len(self.pics) < 3: diff --git a/tests/test_merge_pic.py b/tests/test_merge_pic.py index 3ac9a15..6dcd2c2 100644 --- a/tests/test_merge_pic.py +++ b/tests/test_merge_pic.py @@ -21,6 +21,20 @@ merge_source_9 = [ "https://wx4.sinaimg.cn/large/0071VPLMgy1gq0vifc826j30rs4a64qs.jpg", "https://wx1.sinaimg.cn/large/0071VPLMgy1gq0vify21lj30rsbj71ld.jpg", ] +merge_source_9_2 = [ + 'https://wx2.sinaimg.cn/large/0071VPLMgy1gxo0eyycd7j30dw0dd3zk.jpg', + 'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0eyx6mhj30dw0ddjs8.jpg', + 'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0eyxf2bj30dw0dddh4.jpg', + 'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0ez1h5zj30dw0efwfs.jpg', + 'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0eyyku4j30dw0ef3zm.jpg', + 'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0ez0bjhj30dw0efabs.jpg', + 'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0ezdcafj30dw0dwacb.jpg', + 'https://wx1.sinaimg.cn/large/0071VPLMgy1gxo0ezg2g3j30dw0dwq51.jpg', + 'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0ez5oloj30dw0dw0uf.jpg', + 'https://wx4.sinaimg.cn/large/0071VPLMgy1gxo0fnk6stj30rs44ne81.jpg', + 'https://wx2.sinaimg.cn/large/0071VPLMgy1gxo0fohgcoj30rs3wpe81.jpg', + 'https://wx3.sinaimg.cn/large/0071VPLMgy1gxo0fpr6chj30rs3m1b29.jpg' + ] @pytest.mark.asyncio async def test_9_merge(plugin_module: 'nonebot_bison'): @@ -29,6 +43,13 @@ async def test_9_merge(plugin_module: 'nonebot_bison'): assert len(post.pics) == 5 await post.generate_messages() +@pytest.mark.asyncio +async def test_9_merge_2(plugin_module: 'nonebot_bison'): + post = plugin_module.post.Post('', '', '', pics=merge_source_9_2) + await post._pic_merge() + assert len(post.pics) == 4 + await post.generate_messages() + @pytest.mark.asyncio async def test_6_merge(plugin_module): post = plugin_module.post.Post('', '', '', pics=merge_source_9[0:6]+merge_source_9[9:]) From f5d139abe6427c50497d0c13cfb184045c00328f Mon Sep 17 00:00:00 2001 From: felinae98 <731499577@qq.com> Date: Sat, 25 Dec 2021 23:57:51 +0800 Subject: [PATCH 3/3] update ncm_artist schedule rate --- src/plugins/nonebot_bison/platform/ncm_artist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/nonebot_bison/platform/ncm_artist.py b/src/plugins/nonebot_bison/platform/ncm_artist.py index 5592acf..28664c9 100644 --- a/src/plugins/nonebot_bison/platform/ncm_artist.py +++ b/src/plugins/nonebot_bison/platform/ncm_artist.py @@ -13,7 +13,7 @@ class NcmArtist(TargetMixin, NewMessage): enabled = True is_common = True schedule_type = 'interval' - schedule_kw = {'minutes': 10} + schedule_kw = {'minutes': 1} name = "网易云-歌手" async def get_target_name(self, target: Target) -> Optional[str]: