ryry-cli 2.71__tar.gz → 2.74__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.
Files changed (28) hide show
  1. {ryry_cli-2.71 → ryry_cli-2.74}/PKG-INFO +1 -1
  2. ryry_cli-2.74/ryry/constant.py +4 -0
  3. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/task.py +1 -1
  4. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/upload.py +94 -76
  5. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/PKG-INFO +1 -1
  6. {ryry_cli-2.71 → ryry_cli-2.74}/setup.py +1 -1
  7. ryry_cli-2.71/ryry/constant.py +0 -4
  8. {ryry_cli-2.71 → ryry_cli-2.74}/LICENSE +0 -0
  9. {ryry_cli-2.71 → ryry_cli-2.74}/README.md +0 -0
  10. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/__init__.py +0 -0
  11. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/main.py +0 -0
  12. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/ryry_server_socket.py +0 -0
  13. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/ryry_service.py +0 -0
  14. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/ryry_webapi.py +0 -0
  15. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/ryry_widget.py +0 -0
  16. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/script_template/__init__.py +0 -0
  17. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/script_template/main.py +0 -0
  18. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/script_template/run.py +0 -0
  19. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/server_func.py +0 -0
  20. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/store.py +0 -0
  21. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/taskUtils.py +0 -0
  22. {ryry_cli-2.71 → ryry_cli-2.74}/ryry/utils.py +0 -0
  23. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/SOURCES.txt +0 -0
  24. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/dependency_links.txt +0 -0
  25. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/entry_points.txt +0 -0
  26. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/requires.txt +0 -0
  27. {ryry_cli-2.71 → ryry_cli-2.74}/ryry_cli.egg-info/top_level.txt +0 -0
  28. {ryry_cli-2.71 → ryry_cli-2.74}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 2.71
3
+ Version: 2.74
4
4
  Summary: ryry tools
5
5
  Home-page: https://github.com/dalipenMedia
6
6
  Author: dalipen
@@ -0,0 +1,4 @@
1
+ #!!!!! do not change this file !!!!!
2
+ app_version="2.74"
3
+ app_bulld_anchor="Noh_2024-11-28 22:09:48.575754"
4
+ app_name="ryry-cli"
@@ -144,7 +144,7 @@ def updateProgress(data, progress=50, taskUUID=None):
144
144
  progress = 0
145
145
  if progress > 100:
146
146
  progress = 100
147
- if realTaskUUID and realTaskUUID.startswith("local_") == False:
147
+ if realTaskUUID and len(realTaskUUID) > 10 and realTaskUUID.startswith("local_") == False:
148
148
  return ryry_webapi.TaskUpdateProgress(realTaskUUID, progress, json.dumps(data))
149
149
 
150
150
  def timeout_killprocess(proc, timeout): # """超过指定的秒数后杀死进程"""
@@ -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.cwd(writepath)
81
+ safe_cwd(ftp, writepath)
82
82
  except ftplib.error_perm as e:
83
83
  if e.args[0].startswith('550'):
84
- ftp.mkd(writepath)
85
- ftp.cwd(writepath)
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,87 +111,41 @@ 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.cwd(writepath)
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.mkd(writepath)
119
- ftp.cwd(writepath)
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
- ftp_172_16_3_215={
126
- "host" : "172.16.3.215",
124
+ return False
125
+ ftp_192_168_50_12={
126
+ "host" : "192.168.50.12",
127
127
  "port": 21,
128
- "username" : "admin",
129
- "password" : "Mecord@2024",
130
- "writepath" : "mcn/cache",
131
- "readpath" : "ftp://172.16.3.215/mcn/cache"
132
- }
133
- ftp_183_6_45_220={
134
- "host" : "183.6.45.220",
135
- "port": 2121,
136
- "username" : "admin",
137
- "password" : "Mecord@2024",
138
- "writepath" : "mcn/cache",
139
- "readpath" : "ftp://183.6.45.220/mcn/cache"
140
- }
141
- ftp_192_168_3_220={
142
- "host": "192.168.3.220",
143
- "port": 21,
144
- "username" : "xinyu100",
145
- "password" : "xinyu100.com",
146
- "writepath" : "1TB01/data/cache/",
147
- # "readpath" : "http://192.168.3.220/01/cache"
148
- "readpath" : "ftp://192.168.3.220/1TB01/data/cache"
128
+ "username" : "mcn",
129
+ "password" : "meco@2024+",
130
+ "writepath" : "mnt/NAS/mcn/cache",
131
+ "readpath" : "ftp://192.168.50.12/mnt/NAS/mcn/cache"
149
132
  }
150
133
  ftp_183_6_90_205={
151
134
  "host" : "183.6.90.205",
152
- "port": 13210,
153
- "username" : "ftpuser",
154
- "password" : "ftpuser",
155
- "writepath" : "cache/",
156
- "readpath" : "ftp://183.6.90.205:13210/cache"
157
- }
158
- ftp_192_168_50_113={
159
- "host" : "192.168.50.113",
160
- "port": 21,
161
- "username" : "ftpuser",
162
- "password" : "ftpuser",
163
- "writepath" : "cache/",
164
- "readpath" : "ftp://192.168.50.113/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"
165
140
  }
166
141
  SUBDOMAIN = {
167
- "183.6.45.220": [
168
- ftp_172_16_3_215,
169
- ftp_183_6_45_220,
170
- {**ftp_192_168_50_113,"path_replace": [ "/mcn/videos/", "/mcn/" ]},
171
- {**ftp_183_6_90_205,"path_replace": [ "/mcn/videos/", "/mcn/" ]}
172
- ],
173
- "172.16.3.215": [
174
- ftp_172_16_3_215,
175
- ftp_183_6_45_220,
176
- {**ftp_192_168_50_113,"path_replace": [ "/mcn/videos/", "/mcn/" ]},
177
- {**ftp_183_6_90_205,"path_replace": [ "/mcn/videos/", "/mcn/" ]}
178
- ],
179
- "192.168.50.113": [
180
- {**ftp_172_16_3_215,"path_replace": [ "/mcn/", "/mcn/videos/" ]},
181
- {**ftp_183_6_45_220,"path_replace": [ "/mcn/", "/mcn/videos/" ]},
182
- ftp_192_168_50_113,
183
- ftp_183_6_90_205,
184
- ],
185
142
  "183.6.90.205": [
186
- {**ftp_172_16_3_215,"path_replace": [ "/mcn/", "/mcn/videos/" ]},
187
- {**ftp_183_6_45_220,"path_replace": [ "/mcn/", "/mcn/videos/" ]},
188
- ftp_192_168_50_113,
143
+ ftp_192_168_50_12,
189
144
  ftp_183_6_90_205,
190
145
  ],
191
- "192.168.3.220": [
192
- {**ftp_172_16_3_215,"path_replace": [ "/1TB01/data/mcn/", "/mcn/videos/" ]},
193
- {**ftp_183_6_45_220,"path_replace": [ "/1TB01/data/mcn/", "/mcn/videos/" ]},
194
- ftp_192_168_3_220
146
+ "192.168.50.138": [
147
+ ftp_192_168_50_12,
148
+ ftp_183_6_90_205,
195
149
  ]
196
150
  }
197
151
 
@@ -242,7 +196,7 @@ def download(url, saveDir):
242
196
 
243
197
  if len(replace_path) > 0:
244
198
  parsed_url = urlparse(url.replace(replace_path[0], replace_path[1]))
245
- remote_filepath = parsed_url.path[1:]
199
+ remote_filepath = parsed_url.path
246
200
  if "." in urlparser.urlparse(url).path:
247
201
  ext = urlparser.urlparse(url).path[urlparser.urlparse(url).path.index("."):]
248
202
  savePath = os.path.join(saveDir, f"{name}{ext}")
@@ -250,9 +204,7 @@ def download(url, saveDir):
250
204
  ftp.retrbinary(f'RETR {remote_filepath}', f.write)
251
205
  return savePath
252
206
  else:
253
- if remote_filepath[-1:] != "/":
254
- remote_filepath += "/"
255
- ftp.cwd(remote_filepath)
207
+ safe_cwd(ftp, remote_filepath)
256
208
  files = ftp.nlst()
257
209
  if files:
258
210
  random_file = random.choice(files)
@@ -285,6 +237,74 @@ def download(url, saveDir):
285
237
  print(f"download fail: {e}")
286
238
  return None
287
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
+
288
308
  def downloadDir(url, saveDir, useCount=-1, autoDelete=False):
289
309
  import uuid, os
290
310
  if len(url) <= 0:
@@ -310,10 +330,8 @@ def downloadDir(url, saveDir, useCount=-1, autoDelete=False):
310
330
 
311
331
  if len(replace_path) > 0:
312
332
  parsed_url = urlparse(url.replace(replace_path[0], replace_path[1]))
313
- remote_filepath = parsed_url.path[1:]
314
- if remote_filepath[-1:] != "/":
315
- remote_filepath += "/"
316
- ftp.cwd(remote_filepath)
333
+ remote_filepath = parsed_url.path
334
+ safe_cwd(ftp, remote_filepath)
317
335
  files = ftp.nlst()
318
336
  savePath = os.path.join(saveDir, f"{name}")
319
337
  if os.path.exists(savePath) == False:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 2.71
3
+ Version: 2.74
4
4
  Summary: ryry tools
5
5
  Home-page: https://github.com/dalipenMedia
6
6
  Author: dalipen
@@ -3,7 +3,7 @@ import os
3
3
  import subprocess
4
4
  import datetime
5
5
 
6
- ryry_version = "2.71"
6
+ ryry_version = "2.74"
7
7
  cur_dir = os.path.dirname(os.path.abspath(__file__))
8
8
  constanspy = os.path.join(cur_dir, "ryry", "constant.py")
9
9
  try:
@@ -1,4 +0,0 @@
1
- #!!!!! do not change this file !!!!!
2
- app_version="2.71"
3
- app_bulld_anchor="Noh_2024-11-08 17:48:28.467173"
4
- app_name="ryry-cli"
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