ryry-cli 2.73__tar.gz → 2.75__tar.gz
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.
- {ryry_cli-2.73 → ryry_cli-2.75}/PKG-INFO +1 -1
- ryry_cli-2.75/ryry/constant.py +4 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/taskUtils.py +35 -32
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/upload.py +92 -28
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/PKG-INFO +1 -1
- {ryry_cli-2.73 → ryry_cli-2.75}/setup.py +1 -1
- ryry_cli-2.73/ryry/constant.py +0 -4
- {ryry_cli-2.73 → ryry_cli-2.75}/LICENSE +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/README.md +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/__init__.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/main.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/ryry_server_socket.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/ryry_service.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/ryry_webapi.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/ryry_widget.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/script_template/__init__.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/script_template/main.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/script_template/run.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/server_func.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/store.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/task.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry/utils.py +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/requires.txt +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry_cli-2.73 → ryry_cli-2.75}/setup.cfg +0 -0
|
@@ -240,38 +240,41 @@ def notifyCounterIfNeed():
|
|
|
240
240
|
}
|
|
241
241
|
})
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
"
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
243
|
+
import subprocess, platform
|
|
244
|
+
#darwin Command Line cannot create pyplot gui because not application with gui
|
|
245
|
+
if platform.system() != 'Darwin':
|
|
246
|
+
try:
|
|
247
|
+
import matplotlib.pyplot as plt
|
|
248
|
+
plt.figure(figsize=(8,3))
|
|
249
|
+
plt.rcParams.update({
|
|
250
|
+
'font.size': 7
|
|
251
|
+
})
|
|
252
|
+
plt.bar(t_l, s_l, color='g', label='success')
|
|
253
|
+
plt.bar(t_l, f_l, bottom=s_l, color='r', label='fail')
|
|
254
|
+
plt.title(f'[{socket.gethostname()}] [{yesterday}] success/fail={s_cnt}/{f_cnt}')
|
|
255
|
+
plt.xlabel('time')
|
|
256
|
+
plt.xticks(ticks=t_l,rotation=45)
|
|
257
|
+
plt.ylabel('count')
|
|
258
|
+
plt.subplots_adjust(bottom=0.25)
|
|
259
|
+
plt.legend()
|
|
260
|
+
fff = os.path.join(os.path.dirname(os.path.abspath(__file__)), "plt.png")
|
|
261
|
+
plt.savefig(fff)
|
|
262
|
+
with open(fff, "rb") as f:
|
|
263
|
+
encode_string = str(base64.b64encode(f.read()), encoding='utf-8')
|
|
264
|
+
md5 = hashlib.md5()
|
|
265
|
+
md5.update(base64.b64decode(encode_string))
|
|
266
|
+
hash = md5.hexdigest()
|
|
267
|
+
notifyWechatRobot({
|
|
268
|
+
"msgtype": "image",
|
|
269
|
+
"image": {
|
|
270
|
+
"base64": encode_string,
|
|
271
|
+
"md5": hash
|
|
272
|
+
}
|
|
273
|
+
})
|
|
274
|
+
os.remove(fff)
|
|
275
|
+
os.remove(task_counter_file)
|
|
276
|
+
except:
|
|
277
|
+
pass
|
|
275
278
|
|
|
276
279
|
def saveCounter(taskUUID, duration, isSuccess):
|
|
277
280
|
try:
|
|
@@ -78,11 +78,11 @@ def upload(src, taskUUID=None, timeout=300, needTranscode=True, keep_it_always=F
|
|
|
78
78
|
def deepFtpUpload(file, new_file_name, ftp, writepath, readpath):
|
|
79
79
|
import ftplib, os
|
|
80
80
|
try:
|
|
81
|
-
ftp
|
|
81
|
+
safe_cwd(ftp, writepath)
|
|
82
82
|
except ftplib.error_perm as e:
|
|
83
83
|
if e.args[0].startswith('550'):
|
|
84
|
-
ftp
|
|
85
|
-
ftp
|
|
84
|
+
safe_mkd(ftp, writepath)
|
|
85
|
+
safe_cwd(ftp, writepath)
|
|
86
86
|
|
|
87
87
|
with open(file, 'rb') as f:
|
|
88
88
|
ftp.storbinary(f'STOR {new_file_name}', f)
|
|
@@ -111,40 +111,40 @@ def _can_connect_ftp(ip, port, username, password, writepath):
|
|
|
111
111
|
ftp.connect(ip, port, timeout=5)
|
|
112
112
|
ftp.login(username, password)
|
|
113
113
|
try:
|
|
114
|
-
ftp
|
|
114
|
+
safe_cwd(ftp, writepath)
|
|
115
115
|
except ftplib.error_perm as e:
|
|
116
116
|
if e.args[0].startswith('550'):
|
|
117
117
|
# 如果远程目录不存在,则创建它
|
|
118
|
-
ftp
|
|
119
|
-
ftp
|
|
118
|
+
safe_mkd(ftp, writepath)
|
|
119
|
+
safe_cwd(ftp, writepath)
|
|
120
120
|
ftp.quit()
|
|
121
121
|
return True
|
|
122
122
|
except Exception as e:
|
|
123
123
|
print(f"Failed to connect to FTP server {ip}:{writepath} {e}")
|
|
124
|
-
return False
|
|
125
|
-
|
|
126
|
-
"host" : "192.168.50.
|
|
124
|
+
return False
|
|
125
|
+
ftp_192_168_50_12={
|
|
126
|
+
"host" : "192.168.50.12",
|
|
127
127
|
"port": 21,
|
|
128
|
-
"username" : "
|
|
129
|
-
"password" : "
|
|
130
|
-
"writepath" : "mcn/cache",
|
|
131
|
-
"readpath" : "ftp://192.168.50.
|
|
128
|
+
"username" : "mcn",
|
|
129
|
+
"password" : "meco@2024+",
|
|
130
|
+
"writepath" : "mnt/NAS/mcn/cache",
|
|
131
|
+
"readpath" : "ftp://192.168.50.12/mnt/NAS/mcn/cache"
|
|
132
132
|
}
|
|
133
133
|
ftp_183_6_90_205={
|
|
134
134
|
"host" : "183.6.90.205",
|
|
135
|
-
"port":
|
|
136
|
-
"username" : "
|
|
137
|
-
"password" : "
|
|
138
|
-
"writepath" : "mcn/cache",
|
|
139
|
-
"readpath" : "ftp://183.6.90.205/mcn/cache"
|
|
135
|
+
"port": 2221,
|
|
136
|
+
"username" : "mcn",
|
|
137
|
+
"password" : "meco@2024+",
|
|
138
|
+
"writepath" : "mnt/NAS/mcn/cache",
|
|
139
|
+
"readpath" : "ftp://183.6.90.205/mnt/NAS/mcn/cache"
|
|
140
140
|
}
|
|
141
141
|
SUBDOMAIN = {
|
|
142
142
|
"183.6.90.205": [
|
|
143
|
-
|
|
143
|
+
ftp_192_168_50_12,
|
|
144
144
|
ftp_183_6_90_205,
|
|
145
145
|
],
|
|
146
146
|
"192.168.50.138": [
|
|
147
|
-
|
|
147
|
+
ftp_192_168_50_12,
|
|
148
148
|
ftp_183_6_90_205,
|
|
149
149
|
]
|
|
150
150
|
}
|
|
@@ -196,7 +196,7 @@ def download(url, saveDir):
|
|
|
196
196
|
|
|
197
197
|
if len(replace_path) > 0:
|
|
198
198
|
parsed_url = urlparse(url.replace(replace_path[0], replace_path[1]))
|
|
199
|
-
remote_filepath = parsed_url.path
|
|
199
|
+
remote_filepath = parsed_url.path
|
|
200
200
|
if "." in urlparser.urlparse(url).path:
|
|
201
201
|
ext = urlparser.urlparse(url).path[urlparser.urlparse(url).path.index("."):]
|
|
202
202
|
savePath = os.path.join(saveDir, f"{name}{ext}")
|
|
@@ -204,9 +204,7 @@ def download(url, saveDir):
|
|
|
204
204
|
ftp.retrbinary(f'RETR {remote_filepath}', f.write)
|
|
205
205
|
return savePath
|
|
206
206
|
else:
|
|
207
|
-
|
|
208
|
-
remote_filepath += "/"
|
|
209
|
-
ftp.cwd(remote_filepath)
|
|
207
|
+
safe_cwd(ftp, remote_filepath)
|
|
210
208
|
files = ftp.nlst()
|
|
211
209
|
if files:
|
|
212
210
|
random_file = random.choice(files)
|
|
@@ -239,6 +237,74 @@ def download(url, saveDir):
|
|
|
239
237
|
print(f"download fail: {e}")
|
|
240
238
|
return None
|
|
241
239
|
|
|
240
|
+
def safe_cwd(ftp, path):
|
|
241
|
+
try:
|
|
242
|
+
ftp.cwd(path)
|
|
243
|
+
return
|
|
244
|
+
except:
|
|
245
|
+
pass
|
|
246
|
+
|
|
247
|
+
if path[0:1] == "/":
|
|
248
|
+
try:
|
|
249
|
+
ftp.cwd(path.lstrip('/'))
|
|
250
|
+
return
|
|
251
|
+
except:
|
|
252
|
+
pass
|
|
253
|
+
else:
|
|
254
|
+
try:
|
|
255
|
+
ftp.cwd('/' + path)
|
|
256
|
+
return
|
|
257
|
+
except:
|
|
258
|
+
pass
|
|
259
|
+
|
|
260
|
+
if path[-1:] != "/":
|
|
261
|
+
try:
|
|
262
|
+
ftp.cwd(path + "/")
|
|
263
|
+
return
|
|
264
|
+
except:
|
|
265
|
+
pass
|
|
266
|
+
else:
|
|
267
|
+
try:
|
|
268
|
+
ftp.cwd(path.rstrip('/'))
|
|
269
|
+
return
|
|
270
|
+
except:
|
|
271
|
+
pass
|
|
272
|
+
raise Exception("cwd fail!")
|
|
273
|
+
|
|
274
|
+
def safe_mkd(ftp, path):
|
|
275
|
+
try:
|
|
276
|
+
ftp.mkd(path)
|
|
277
|
+
return
|
|
278
|
+
except:
|
|
279
|
+
pass
|
|
280
|
+
|
|
281
|
+
if path[0:1] == "/":
|
|
282
|
+
try:
|
|
283
|
+
ftp.mkd(path.lstrip('/'))
|
|
284
|
+
return
|
|
285
|
+
except:
|
|
286
|
+
pass
|
|
287
|
+
else:
|
|
288
|
+
try:
|
|
289
|
+
ftp.mkd('/' + path)
|
|
290
|
+
return
|
|
291
|
+
except:
|
|
292
|
+
pass
|
|
293
|
+
|
|
294
|
+
if path[-1:] != "/":
|
|
295
|
+
try:
|
|
296
|
+
ftp.mkd(path + "/")
|
|
297
|
+
return
|
|
298
|
+
except:
|
|
299
|
+
pass
|
|
300
|
+
else:
|
|
301
|
+
try:
|
|
302
|
+
ftp.mkd(path.rstrip('/'))
|
|
303
|
+
return
|
|
304
|
+
except:
|
|
305
|
+
pass
|
|
306
|
+
raise Exception("cwd fail!")
|
|
307
|
+
|
|
242
308
|
def downloadDir(url, saveDir, useCount=-1, autoDelete=False):
|
|
243
309
|
import uuid, os
|
|
244
310
|
if len(url) <= 0:
|
|
@@ -264,10 +330,8 @@ def downloadDir(url, saveDir, useCount=-1, autoDelete=False):
|
|
|
264
330
|
|
|
265
331
|
if len(replace_path) > 0:
|
|
266
332
|
parsed_url = urlparse(url.replace(replace_path[0], replace_path[1]))
|
|
267
|
-
remote_filepath = parsed_url.path
|
|
268
|
-
|
|
269
|
-
remote_filepath += "/"
|
|
270
|
-
ftp.cwd(remote_filepath)
|
|
333
|
+
remote_filepath = parsed_url.path
|
|
334
|
+
safe_cwd(ftp, remote_filepath)
|
|
271
335
|
files = ftp.nlst()
|
|
272
336
|
savePath = os.path.join(saveDir, f"{name}")
|
|
273
337
|
if os.path.exists(savePath) == False:
|
ryry_cli-2.73/ryry/constant.py
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|