ryry-cli 4.10__tar.gz → 4.12__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-4.10/ryry_cli.egg-info → ryry_cli-4.12}/PKG-INFO +1 -1
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/constant.py +2 -2
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/ryry_server_socket.py +1 -1
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/shared_memory.py +9 -2
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/upload.py +44 -14
- {ryry_cli-4.10 → ryry_cli-4.12/ryry_cli.egg-info}/PKG-INFO +1 -1
- {ryry_cli-4.10 → ryry_cli-4.12}/setup.py +1 -1
- {ryry_cli-4.10 → ryry_cli-4.12}/LICENSE +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/README.md +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/__init__.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/daemon_base.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/daemon_manager.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/main.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/ryry_service.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/ryry_webapi.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/ryry_widget.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/script_template/__init__.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/script_template/daemon.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/script_template/main.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/script_template/run.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/server_func.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/store.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/task.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/taskUtils.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry/utils.py +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry_cli.egg-info/requires.txt +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry_cli-4.10 → ryry_cli-4.12}/setup.cfg +0 -0
|
@@ -541,24 +541,30 @@ class SharedMemoryService:
|
|
|
541
541
|
def get_max_counter(self) -> int:
|
|
542
542
|
"""获取最大计数器(只读操作)"""
|
|
543
543
|
data = self._read_data()
|
|
544
|
-
|
|
544
|
+
max_counter = data.get("max_counter", 1)
|
|
545
|
+
print(f"get_max_counter = {max_counter}")
|
|
546
|
+
return max_counter
|
|
545
547
|
|
|
546
548
|
def set_cur_counter(self, cur_counter: int):
|
|
547
549
|
"""设置当前计数器"""
|
|
548
550
|
def operation(data):
|
|
549
551
|
data["cur_counter"] = cur_counter
|
|
552
|
+
print(f"set_cur_counter = {cur_counter}")
|
|
550
553
|
return cur_counter
|
|
551
554
|
return self._atomic_operation(operation)
|
|
552
555
|
|
|
553
556
|
def get_cur_counter(self) -> int:
|
|
554
557
|
"""获取当前计数器(只读操作)"""
|
|
555
558
|
data = self._read_data()
|
|
556
|
-
|
|
559
|
+
cur_counter = data.get("cur_counter", 0)
|
|
560
|
+
print(f"get_cur_counter = {cur_counter}")
|
|
561
|
+
return cur_counter
|
|
557
562
|
|
|
558
563
|
def increment_cur_counter(self) -> int:
|
|
559
564
|
"""增加当前计数器"""
|
|
560
565
|
def operation(data):
|
|
561
566
|
data["cur_counter"] = data.get("cur_counter", 0) + 1
|
|
567
|
+
print(f"increment_cur_counter")
|
|
562
568
|
return data["cur_counter"]
|
|
563
569
|
return self._atomic_operation(operation)
|
|
564
570
|
|
|
@@ -566,6 +572,7 @@ class SharedMemoryService:
|
|
|
566
572
|
"""减少当前计数器"""
|
|
567
573
|
def operation(data):
|
|
568
574
|
data["cur_counter"] = max(0, data.get("cur_counter", 0) - 1)
|
|
575
|
+
print(f"decrement_cur_counter")
|
|
569
576
|
return data["cur_counter"]
|
|
570
577
|
return self._atomic_operation(operation)
|
|
571
578
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from urllib.parse import *
|
|
2
|
+
import time
|
|
2
3
|
|
|
3
4
|
def transcode(srcFile):
|
|
4
5
|
try:
|
|
@@ -71,10 +72,10 @@ def upload(src, taskUUID=None, needTranscode=False, keepItAlways=False, addition
|
|
|
71
72
|
uploadPath = os.path.join('/mnt/NAS/mcn/', uploadPath)
|
|
72
73
|
|
|
73
74
|
|
|
75
|
+
needDeleteSrc = False
|
|
74
76
|
if needTranscode:
|
|
75
77
|
needDeleteSrc, newSrc = transcode(src)
|
|
76
78
|
else:
|
|
77
|
-
needDeleteSrc = False
|
|
78
79
|
newSrc = src
|
|
79
80
|
|
|
80
81
|
# 根据targetDomain判断使用不同的上传逻辑
|
|
@@ -182,7 +183,6 @@ def uploadToOss(file, new_file_name, oss_config, upload_path=""):
|
|
|
182
183
|
raise Exception(f"OSS upload failed: {response.status_code}")
|
|
183
184
|
|
|
184
185
|
def deepFtpUpload(file, new_file_name, ftp, writepath, readpath):
|
|
185
|
-
import ftplib, os
|
|
186
186
|
try:
|
|
187
187
|
safe_cwd(ftp, writepath)
|
|
188
188
|
except:
|
|
@@ -200,20 +200,45 @@ def ftpUpload(file, new_file_name, subdomain, upload_path=""):
|
|
|
200
200
|
password = subdomain["password"]
|
|
201
201
|
writepath = subdomain["writepath"]
|
|
202
202
|
readpath = subdomain["readpath"]
|
|
203
|
+
retry = 0
|
|
203
204
|
import ftplib
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
while retry < 3:
|
|
206
|
+
try:
|
|
207
|
+
if retry > 0:
|
|
208
|
+
has_bak = FTP_REPLACEMENT.get(ip, None)
|
|
209
|
+
if has_bak:
|
|
210
|
+
bak_config = DOMAIN_CONFIG.get(has_bak, None)["config"]
|
|
211
|
+
ftp = ftplib.FTP()
|
|
212
|
+
ftp.connect(bak_config["host"], bak_config["port"], timeout=5)
|
|
213
|
+
ftp.login(bak_config["username"], bak_config["password"])
|
|
214
|
+
if upload_path:
|
|
215
|
+
if upload_path[0:1] == "/":
|
|
216
|
+
upload_path = upload_path[1:]
|
|
217
|
+
s = deepFtpUpload(file, new_file_name, ftp, upload_path, f'ftp://{ip}/{upload_path}')
|
|
218
|
+
else:
|
|
219
|
+
s = deepFtpUpload(file, new_file_name, ftp, writepath, readpath)
|
|
220
|
+
|
|
221
|
+
ftp.quit()
|
|
222
|
+
return s
|
|
207
223
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
224
|
+
ftp = ftplib.FTP()
|
|
225
|
+
ftp.connect(ip, port, timeout=5)
|
|
226
|
+
ftp.login(username, password)
|
|
227
|
+
|
|
228
|
+
if upload_path:
|
|
229
|
+
if upload_path[0:1] == "/":
|
|
230
|
+
upload_path = upload_path[1:]
|
|
231
|
+
s = deepFtpUpload(file, new_file_name, ftp, upload_path, f'ftp://{ip}/{upload_path}')
|
|
232
|
+
else:
|
|
233
|
+
s = deepFtpUpload(file, new_file_name, ftp, writepath, readpath)
|
|
234
|
+
|
|
235
|
+
ftp.quit()
|
|
236
|
+
return s
|
|
237
|
+
except:
|
|
238
|
+
time.sleep(5)
|
|
239
|
+
finally:
|
|
240
|
+
retry+=1
|
|
241
|
+
raise Exception("uplad fail!")
|
|
217
242
|
|
|
218
243
|
def _can_connect_ftp(ip, port, username, password, writepath):
|
|
219
244
|
import ftplib
|
|
@@ -299,6 +324,11 @@ DOMAIN_CONFIG = {
|
|
|
299
324
|
"*.mecordai.com": {"type": "mecord-cli", "config": {}},
|
|
300
325
|
}
|
|
301
326
|
|
|
327
|
+
FTP_REPLACEMENT = {
|
|
328
|
+
"192.168.50.12": "183.6.90.205",
|
|
329
|
+
"183.6.90.205": "192.168.50.12",
|
|
330
|
+
}
|
|
331
|
+
|
|
302
332
|
SUBDOMAIN = {
|
|
303
333
|
"183.6.90.205": [
|
|
304
334
|
ftp_192_168_50_12,
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|