ryry-cli 4.3__tar.gz → 4.4__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.3/ryry_cli.egg-info → ryry_cli-4.4}/PKG-INFO +2 -1
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/constant.py +2 -2
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/upload.py +54 -9
- {ryry_cli-4.3 → ryry_cli-4.4/ryry_cli.egg-info}/PKG-INFO +2 -1
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry_cli.egg-info/requires.txt +1 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/setup.py +2 -1
- {ryry_cli-4.3 → ryry_cli-4.4}/LICENSE +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/README.md +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/__init__.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/daemon_base.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/daemon_manager.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/main.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/ryry_server_socket.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/ryry_service.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/ryry_webapi.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/ryry_widget.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/script_template/__init__.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/script_template/daemon.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/script_template/main.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/script_template/run.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/server_func.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/shared_memory.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/store.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/task.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/taskUtils.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry/utils.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.4}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ryry-cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4
|
|
4
4
|
Summary: ryry tools
|
|
5
5
|
Home-page: https://github.com/dalipenMedia
|
|
6
6
|
Author: dalipen
|
|
@@ -23,6 +23,7 @@ Requires-Dist: gputil
|
|
|
23
23
|
Requires-Dist: urlparser
|
|
24
24
|
Requires-Dist: urllib3
|
|
25
25
|
Requires-Dist: portalocker
|
|
26
|
+
Requires-Dist: mecord-cli>=0.7.405
|
|
26
27
|
|
|
27
28
|
ryry Python Tool
|
|
28
29
|
===============================================
|
|
@@ -46,12 +46,17 @@ def additionalUrl(srcFile, ossUrl):
|
|
|
46
46
|
def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additionalUrl=False):
|
|
47
47
|
import os
|
|
48
48
|
from pathlib import Path
|
|
49
|
-
from ryry import taskUtils
|
|
49
|
+
from ryry import taskUtils as ryry_taskUtils
|
|
50
50
|
if os.path.exists(src) == False:
|
|
51
51
|
raise Exception(f"upload file not found")
|
|
52
52
|
if taskUUID == None or len(taskUUID) <= 0:
|
|
53
|
-
taskUUID =
|
|
54
|
-
|
|
53
|
+
taskUUID = ryry_taskUtils.taskInfoWithFirstTask()
|
|
54
|
+
targetDomain = ryry_taskUtils.taskDomainWithUUID(taskUUID)
|
|
55
|
+
else:
|
|
56
|
+
targetDomain = ryry_taskUtils.taskDomainWithUUID(taskUUID)
|
|
57
|
+
if targetDomain == None or len(targetDomain) <= 0:
|
|
58
|
+
from mecord import taskUtils as mecord_taskUtils
|
|
59
|
+
targetDomain = mecord_taskUtils.taskDomainWithUUID(taskUUID)
|
|
55
60
|
|
|
56
61
|
if needTranscode:
|
|
57
62
|
needDeleteSrc, newSrc = transcode(src)
|
|
@@ -60,7 +65,7 @@ def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additiona
|
|
|
60
65
|
newSrc = src
|
|
61
66
|
|
|
62
67
|
# 根据targetDomain判断使用不同的上传逻辑
|
|
63
|
-
ossurl = uploadByDomain(newSrc, targetDomain, keepItAlways)
|
|
68
|
+
ossurl = uploadByDomain(newSrc, targetDomain, taskUUID, keepItAlways)
|
|
64
69
|
|
|
65
70
|
if additionalUrl:
|
|
66
71
|
ossurl = additionalUrl(newSrc, ossurl)
|
|
@@ -68,7 +73,7 @@ def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additiona
|
|
|
68
73
|
os.remove(newSrc)
|
|
69
74
|
return ossurl
|
|
70
75
|
|
|
71
|
-
def uploadByDomain(src, targetDomain, keepItAlways=False):
|
|
76
|
+
def uploadByDomain(src, targetDomain, taskUUID, keepItAlways=False):
|
|
72
77
|
import os
|
|
73
78
|
from pathlib import Path
|
|
74
79
|
import uuid
|
|
@@ -79,6 +84,10 @@ def uploadByDomain(src, targetDomain, keepItAlways=False):
|
|
|
79
84
|
new_file_name = ''.join(str(uuid.uuid4()).split('-'))
|
|
80
85
|
|
|
81
86
|
parsed_domain, upload_path = parseDomainAndPath(targetDomain)
|
|
87
|
+
if isMecordConfig(parsed_domain):
|
|
88
|
+
from mecord import upload as mecord_upload
|
|
89
|
+
return mecord_upload.upload(src, taskUUID)
|
|
90
|
+
|
|
82
91
|
oss_config = getOssConfig(parsed_domain)
|
|
83
92
|
if oss_config:
|
|
84
93
|
return uploadToOss(src, f"{new_file_name}.{ext}", oss_config, upload_path)
|
|
@@ -239,6 +248,24 @@ oss_template_config = {
|
|
|
239
248
|
"domain": "https://oss.zjtemplate.com"
|
|
240
249
|
}
|
|
241
250
|
|
|
251
|
+
def match_wildcard_domain(target_domain, pattern):
|
|
252
|
+
if pattern.startswith("*."):
|
|
253
|
+
suffix = pattern[1:] # 去掉 "*." 前缀
|
|
254
|
+
return target_domain.endswith(suffix)
|
|
255
|
+
return target_domain == pattern
|
|
256
|
+
|
|
257
|
+
def get_domain_config(target_domain):
|
|
258
|
+
# 首先尝试精确匹配
|
|
259
|
+
if target_domain in DOMAIN_CONFIG:
|
|
260
|
+
return DOMAIN_CONFIG[target_domain]
|
|
261
|
+
|
|
262
|
+
# 然后尝试通配符匹配
|
|
263
|
+
for pattern, config in DOMAIN_CONFIG.items():
|
|
264
|
+
if match_wildcard_domain(target_domain, pattern):
|
|
265
|
+
return config
|
|
266
|
+
|
|
267
|
+
return None
|
|
268
|
+
|
|
242
269
|
DOMAIN_CONFIG = {
|
|
243
270
|
"192.168.50.12": {"type": "ftp", "config": ftp_192_168_50_12},
|
|
244
271
|
"183.6.90.205": {"type": "ftp", "config": ftp_183_6_90_205},
|
|
@@ -247,6 +274,8 @@ DOMAIN_CONFIG = {
|
|
|
247
274
|
"res.zjtemplate.com": {"type": "oss", "config": oss_res_config},
|
|
248
275
|
"upload.zjtemplate.com": {"type": "oss", "config": oss_upload_config},
|
|
249
276
|
"oss.zjtemplate.com": {"type": "oss", "config": oss_template_config},
|
|
277
|
+
"*.mecoai.cn": {"type": "mecord-cli", "config": {}},
|
|
278
|
+
"*.mecordai.com": {"type": "mecord-cli", "config": {}},
|
|
250
279
|
}
|
|
251
280
|
|
|
252
281
|
SUBDOMAIN = {
|
|
@@ -261,13 +290,21 @@ SUBDOMAIN = {
|
|
|
261
290
|
}
|
|
262
291
|
|
|
263
292
|
def getOssConfig(targetDomain):
|
|
264
|
-
|
|
265
|
-
|
|
293
|
+
config = get_domain_config(targetDomain)
|
|
294
|
+
if config and config["type"] == "oss":
|
|
295
|
+
return config["config"]
|
|
266
296
|
return None
|
|
267
297
|
|
|
298
|
+
def isMecordConfig(targetDomain):
|
|
299
|
+
config = get_domain_config(targetDomain)
|
|
300
|
+
if config and config["type"] == "mecord-cli":
|
|
301
|
+
return True
|
|
302
|
+
return False
|
|
303
|
+
|
|
268
304
|
def getFtpConfig(targetDomain):
|
|
269
|
-
|
|
270
|
-
|
|
305
|
+
config = get_domain_config(targetDomain)
|
|
306
|
+
if config and config["type"] == "ftp":
|
|
307
|
+
return config["config"]
|
|
271
308
|
return None
|
|
272
309
|
|
|
273
310
|
def getSubdomain(targetDomain):
|
|
@@ -300,6 +337,14 @@ def getFirstSupportSubdomain():
|
|
|
300
337
|
for domain, config in DOMAIN_CONFIG.items():
|
|
301
338
|
if config["type"] == "oss":
|
|
302
339
|
return {"type": "oss", "config": config["config"], "domain": config["config"]["domain"]}
|
|
340
|
+
if config["type"] == "mecord-cli":
|
|
341
|
+
# 对于通配符域名,返回一个示例域名
|
|
342
|
+
if domain.startswith("*."):
|
|
343
|
+
# 将 *.mecoai.cn 转换为 example.mecoai.cn
|
|
344
|
+
example_domain = "example" + domain[1:]
|
|
345
|
+
return {"type": "mecord-cli", "config": {}, "domain": example_domain}
|
|
346
|
+
else:
|
|
347
|
+
return {"type": "mecord-cli", "config": {}, "domain": domain}
|
|
303
348
|
elif config["type"] == "ftp":
|
|
304
349
|
ftp_config = config["config"]
|
|
305
350
|
if _can_connect_ftp(ftp_config["host"], ftp_config["port"], ftp_config["username"], ftp_config["password"], ftp_config["writepath"]):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ryry-cli
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.4
|
|
4
4
|
Summary: ryry tools
|
|
5
5
|
Home-page: https://github.com/dalipenMedia
|
|
6
6
|
Author: dalipen
|
|
@@ -23,6 +23,7 @@ Requires-Dist: gputil
|
|
|
23
23
|
Requires-Dist: urlparser
|
|
24
24
|
Requires-Dist: urllib3
|
|
25
25
|
Requires-Dist: portalocker
|
|
26
|
+
Requires-Dist: mecord-cli>=0.7.405
|
|
26
27
|
|
|
27
28
|
ryry Python Tool
|
|
28
29
|
===============================================
|
|
@@ -3,7 +3,7 @@ import os
|
|
|
3
3
|
import subprocess
|
|
4
4
|
import datetime
|
|
5
5
|
|
|
6
|
-
ryry_version = "4.
|
|
6
|
+
ryry_version = "4.4"
|
|
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:
|
|
@@ -70,6 +70,7 @@ setuptools.setup(
|
|
|
70
70
|
'urlparser',
|
|
71
71
|
'urllib3',
|
|
72
72
|
'portalocker',
|
|
73
|
+
'mecord-cli>=0.7.405',
|
|
73
74
|
],
|
|
74
75
|
dependency_links=[],
|
|
75
76
|
entry_points={
|
|
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
|
|
File without changes
|