reywechat 1.0.28__py3-none-any.whl → 1.0.29__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reywechat/rcache.py +3 -2
- reywechat/rdb.py +4 -3
- reywechat/rlog.py +1 -1
- reywechat/rreceive.py +17 -8
- reywechat/rsend.py +0 -1
- reywechat/rwechat.py +1 -2
- {reywechat-1.0.28.dist-info → reywechat-1.0.29.dist-info}/METADATA +1 -1
- reywechat-1.0.29.dist-info/RECORD +17 -0
- reywechat-1.0.28.dist-info/RECORD +0 -17
- {reywechat-1.0.28.dist-info → reywechat-1.0.29.dist-info}/WHEEL +0 -0
- {reywechat-1.0.28.dist-info → reywechat-1.0.29.dist-info}/licenses/LICENSE +0 -0
reywechat/rcache.py
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
"""
|
10
10
|
|
11
11
|
|
12
|
-
from reykit.ros import FileCache
|
12
|
+
from reykit.ros import FileCache, join_path
|
13
13
|
|
14
14
|
from .rbase import BaseWeChat
|
15
15
|
from .rwechat import WeChat
|
@@ -40,7 +40,8 @@ class WeChatCache(BaseWeChat, FileCache):
|
|
40
40
|
|
41
41
|
# Set attribute.
|
42
42
|
self.wechat = wechat
|
43
|
-
|
43
|
+
path = join_path(self.wechat.project_dir, 'cache')
|
44
|
+
self.cache = FileCache(path)
|
44
45
|
self.folder = self.cache.folder
|
45
46
|
self.index = self.cache.index
|
46
47
|
self.store = self.cache.store
|
reywechat/rdb.py
CHANGED
@@ -13,7 +13,7 @@ from typing import Any, Literal, overload
|
|
13
13
|
from json import loads as json_loads
|
14
14
|
from reydb.rdb import Database
|
15
15
|
from reykit.rbase import throw
|
16
|
-
from reykit.ros import File
|
16
|
+
from reykit.ros import File
|
17
17
|
from reykit.rtime import to_time, time_to, sleep
|
18
18
|
from reykit.rwrap import wrap_thread
|
19
19
|
|
@@ -56,7 +56,7 @@ class WeChatDatabase(BaseWeChat):
|
|
56
56
|
self.wechat = wechat
|
57
57
|
match rdatabase:
|
58
58
|
case Database():
|
59
|
-
self.rdatabase_wechat
|
59
|
+
self.rdatabase_wechat = self.rdatabase_file = rdatabase
|
60
60
|
case dict():
|
61
61
|
self.rdatabase_wechat: Database = rdatabase.get('wechat')
|
62
62
|
self.rdatabase_file: Database = rdatabase.get('file')
|
@@ -1234,7 +1234,8 @@ class WeChatDatabase(BaseWeChat):
|
|
1234
1234
|
if 'file_name' in params:
|
1235
1235
|
file_name: str = params.pop('file_name')
|
1236
1236
|
else:
|
1237
|
-
|
1237
|
+
file = File(file_path)
|
1238
|
+
file_name = file.name_suffix
|
1238
1239
|
|
1239
1240
|
## Cache.
|
1240
1241
|
cache_path = self.wechat.cache.store(file_path, file_name)
|
reywechat/rlog.py
CHANGED
@@ -100,7 +100,7 @@ class WeChatLog(BaseWeChat):
|
|
100
100
|
self.rrlog_print.add_print(format_=format_)
|
101
101
|
|
102
102
|
## Add handler file.
|
103
|
-
file_path = self.
|
103
|
+
file_path = self.folder + 'wechat'
|
104
104
|
self.rrlog_file.add_file(
|
105
105
|
file_path,
|
106
106
|
time='m',
|
reywechat/rreceive.py
CHANGED
@@ -16,10 +16,10 @@ from queue import Queue
|
|
16
16
|
from json import loads as json_loads
|
17
17
|
from bs4 import BeautifulSoup as BSBeautifulSoup
|
18
18
|
from bs4.element import Tag as BSTag
|
19
|
-
from reykit.rbase import throw
|
19
|
+
from reykit.rbase import throw
|
20
20
|
from reykit.rimage import decode_qrcode
|
21
21
|
from reykit.rnet import listen_socket
|
22
|
-
from reykit.ros import File,
|
22
|
+
from reykit.ros import File, os_exists
|
23
23
|
from reykit.rre import search, findall
|
24
24
|
from reykit.rtask import ThreadPool
|
25
25
|
from reykit.rtime import sleep, wait
|
@@ -416,6 +416,8 @@ class WeChatMessage(BaseWeChat):
|
|
416
416
|
pattern = r'@\w+\u2005'
|
417
417
|
self._at_names = findall(pattern, text)
|
418
418
|
|
419
|
+
return self._at_names
|
420
|
+
|
419
421
|
|
420
422
|
@property
|
421
423
|
def is_at(self) -> bool:
|
@@ -1121,7 +1123,8 @@ class WechatReceiver(BaseWeChat):
|
|
1121
1123
|
case 3:
|
1122
1124
|
pattern = r' md5="([\da-f]{32})"'
|
1123
1125
|
file_md5: str = search(pattern, message.data)
|
1124
|
-
|
1126
|
+
file_name = f'{file_md5}.jpg'
|
1127
|
+
cache_path = self.wechat.cache.index(file_md5, file_name, copy=True)
|
1125
1128
|
|
1126
1129
|
### Download.
|
1127
1130
|
if cache_path is None:
|
@@ -1133,6 +1136,8 @@ class WechatReceiver(BaseWeChat):
|
|
1133
1136
|
|
1134
1137
|
## Voice.
|
1135
1138
|
case 34:
|
1139
|
+
file_name = None
|
1140
|
+
file_name_suffix = 'amr'
|
1136
1141
|
cache_path = None
|
1137
1142
|
|
1138
1143
|
### Download.
|
@@ -1146,7 +1151,8 @@ class WechatReceiver(BaseWeChat):
|
|
1146
1151
|
case 43:
|
1147
1152
|
pattern = r' md5="([\da-f]{32})"'
|
1148
1153
|
file_md5: str = search(pattern, message.data)
|
1149
|
-
|
1154
|
+
file_name = f'{file_md5}.mp4'
|
1155
|
+
cache_path = self.wechat.cache.index(file_md5, file_name, copy=True)
|
1150
1156
|
|
1151
1157
|
### Download.
|
1152
1158
|
if cache_path is None:
|
@@ -1197,15 +1203,18 @@ class WechatReceiver(BaseWeChat):
|
|
1197
1203
|
sleep(0.2)
|
1198
1204
|
|
1199
1205
|
## Cache.
|
1206
|
+
download_file = File(download_path)
|
1207
|
+
if file_name is None:
|
1208
|
+
file_name = f'{download_file.md5}.{file_name_suffix}'
|
1200
1209
|
cache_path = self.wechat.cache.store(download_path, file_name, delete=True)
|
1201
1210
|
|
1202
1211
|
# Set parameter.
|
1203
|
-
|
1212
|
+
cache_file = File(cache_path)
|
1204
1213
|
message_file: MessageParameterFile = {
|
1205
1214
|
'path': cache_path,
|
1206
|
-
'name':
|
1207
|
-
'md5':
|
1208
|
-
'size':
|
1215
|
+
'name': cache_file.name_suffix,
|
1216
|
+
'md5': cache_file.md5,
|
1217
|
+
'size': cache_file.size
|
1209
1218
|
}
|
1210
1219
|
message.file = message_file
|
1211
1220
|
|
reywechat/rsend.py
CHANGED
@@ -17,7 +17,6 @@ from functools import wraps as functools_wraps
|
|
17
17
|
from queue import Queue
|
18
18
|
from re import escape as re_escape
|
19
19
|
from reykit.rbase import throw, catch_exc
|
20
|
-
from reykit.ros import File
|
21
20
|
from reykit.rre import sub
|
22
21
|
from reykit.rtime import sleep
|
23
22
|
from reykit.rwrap import wrap_thread, wrap_exc
|
reywechat/rwechat.py
CHANGED
@@ -13,7 +13,6 @@ from typing import Literal
|
|
13
13
|
from os import getcwd as os_getcwd
|
14
14
|
from reydb.rdb import Database
|
15
15
|
from reykit.rbase import block
|
16
|
-
from reykit.ros import Folder, join_path
|
17
16
|
|
18
17
|
from .rbase import BaseWeChat
|
19
18
|
|
@@ -107,7 +106,7 @@ class WeChat(BaseWeChat):
|
|
107
106
|
self.wrap_try_send = self.sender.wrap_try_send
|
108
107
|
|
109
108
|
## Database.
|
110
|
-
self.send = self.database.send
|
109
|
+
self.send = self.sender.send = self.database.send
|
111
110
|
|
112
111
|
## Schedule.
|
113
112
|
self.schedule_add_task = self.schedule.add_task
|
@@ -0,0 +1,17 @@
|
|
1
|
+
reywechat/__init__.py,sha256=BL4PUpTguszJ612qsZf4-sOXxRIsiYRQ_m__FGMd1RQ,513
|
2
|
+
reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
3
|
+
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
+
reywechat/rcache.py,sha256=Hh_HE-t_KUMlrz4gEFPh1AjmhnrSgH520IFJPumWb7A,908
|
5
|
+
reywechat/rclient.py,sha256=gtTYaoqhgh9kRFslETKjBJiAAdzJfeOxIJbdCkGAFhM,22577
|
6
|
+
reywechat/rdb.py,sha256=Gcj3d-uIospaacjHY8B4HHdru5OwiS9PO6cceAWvXqY,40333
|
7
|
+
reywechat/rlog.py,sha256=d3S0eHMUZ92OLE7fjP3zzikIYANtnbAxhnE_DIV_1OY,5251
|
8
|
+
reywechat/rreceive.py,sha256=5emlgnIChYL60yx6PoQc1h5aGHFXNuFJ71a585gamEg,31550
|
9
|
+
reywechat/rschedule.py,sha256=fn11rH0HqxbnJYxARCBBiSdzBpYfQFhcjNmkvihVMTc,1854
|
10
|
+
reywechat/rsend.py,sha256=s2sR6l74reDShBAu_MwpavVunz0g42pIga0zX4ElIuI,13717
|
11
|
+
reywechat/rtrigger.py,sha256=GHfkhNrS8rV4uXWC3N54UTjak7nKGfqJWX6pe57Hsgg,4953
|
12
|
+
reywechat/rwechat.py,sha256=K9fwje_Sos3Pvke8tFexDNZsRD7FsLtH3Jktg9xREpk,4788
|
13
|
+
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
+
reywechat-1.0.29.dist-info/METADATA,sha256=GQNNn2iqWueYDLoZuKQGnmmQqMgEJlBPAtqQeFY3U3s,1551
|
15
|
+
reywechat-1.0.29.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
+
reywechat-1.0.29.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
+
reywechat-1.0.29.dist-info/RECORD,,
|
@@ -1,17 +0,0 @@
|
|
1
|
-
reywechat/__init__.py,sha256=BL4PUpTguszJ612qsZf4-sOXxRIsiYRQ_m__FGMd1RQ,513
|
2
|
-
reywechat/rall.py,sha256=zEW-mLL2uP8aT2_foCMFGmMi_3RCrGl8qutnSVkmY1E,397
|
3
|
-
reywechat/rbase.py,sha256=0NunIUIXra2ML2N6odwMk5oENTE0r6VSBHWXUvgI-lc,1124
|
4
|
-
reywechat/rcache.py,sha256=yPGOaotZJ-Ps_6hKXm0jtQXAkdIEHLqr2nR-42syzmQ,856
|
5
|
-
reywechat/rclient.py,sha256=gtTYaoqhgh9kRFslETKjBJiAAdzJfeOxIJbdCkGAFhM,22577
|
6
|
-
reywechat/rdb.py,sha256=WOIdaDp6KENu5Pq9Nbd4uZlSh_SV8SSWcGbL-mu3WZI,40299
|
7
|
-
reywechat/rlog.py,sha256=zbdhPAL5fkJ0HKQuz9DBonJ1dxJ1N8GKROHvBmA6UaE,5262
|
8
|
-
reywechat/rreceive.py,sha256=byrT8MeIKELDRd9CLakk1WfOvxvpMeMiv2SIdcfkLAE,31158
|
9
|
-
reywechat/rschedule.py,sha256=fn11rH0HqxbnJYxARCBBiSdzBpYfQFhcjNmkvihVMTc,1854
|
10
|
-
reywechat/rsend.py,sha256=ShQLsKF6YXXD8SjixMFgqY1VGtIKt4f3odkXvP2dVDk,13746
|
11
|
-
reywechat/rtrigger.py,sha256=GHfkhNrS8rV4uXWC3N54UTjak7nKGfqJWX6pe57Hsgg,4953
|
12
|
-
reywechat/rwechat.py,sha256=tsCwtZN7YVmgrHti0qVoifjC2XcIkjBYYWDK-ZP-YfM,4811
|
13
|
-
reywechat/data/client_api.dll,sha256=H9uj-x9Ztg0jFZK0yY6NsnyH5_119dQRFfoVVMidxRs,592384
|
14
|
-
reywechat-1.0.28.dist-info/METADATA,sha256=Brbyp2S4e_9JJg1mYEeioYkTvDCaOvSYWAV_ZkQv75Y,1551
|
15
|
-
reywechat-1.0.28.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
16
|
-
reywechat-1.0.28.dist-info/licenses/LICENSE,sha256=UYLPqp7BvPiH8yEZduJqmmyEl6hlM3lKrFIefiD4rvk,1059
|
17
|
-
reywechat-1.0.28.dist-info/RECORD,,
|
File without changes
|
File without changes
|