ryry-cli 4.3__tar.gz → 4.5__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.5}/PKG-INFO +2 -1
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/constant.py +2 -2
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/upload.py +60 -10
- {ryry_cli-4.3 → ryry_cli-4.5/ryry_cli.egg-info}/PKG-INFO +2 -1
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry_cli.egg-info/requires.txt +1 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/setup.py +2 -1
- {ryry_cli-4.3 → ryry_cli-4.5}/LICENSE +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/README.md +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/__init__.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/daemon_base.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/daemon_manager.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/main.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/ryry_server_socket.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/ryry_service.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/ryry_webapi.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/ryry_widget.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/script_template/__init__.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/script_template/daemon.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/script_template/main.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/script_template/run.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/server_func.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/shared_memory.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/store.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/task.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/taskUtils.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry/utils.py +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry_cli.egg-info/SOURCES.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry_cli.egg-info/dependency_links.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry_cli.egg-info/entry_points.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/ryry_cli.egg-info/top_level.txt +0 -0
- {ryry_cli-4.3 → ryry_cli-4.5}/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.5
|
|
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
|
===============================================
|
|
@@ -43,15 +43,23 @@ def additionalUrl(srcFile, ossUrl):
|
|
|
43
43
|
except:
|
|
44
44
|
return ossUrl
|
|
45
45
|
|
|
46
|
-
def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additionalUrl=False):
|
|
46
|
+
def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additionalUrl=False, uploadPath=None):
|
|
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
|
+
uuid_has_country_info = mecord_taskUtils.taskCountryWithUUID(taskUUID)
|
|
60
|
+
if uuid_has_country_info:
|
|
61
|
+
#这里不区分meco还是mecord,请求meco/mecord后端接口时,根据本地状态来向不同服务器请求
|
|
62
|
+
targetDomain = "https://m.mecoai.cn/"
|
|
55
63
|
|
|
56
64
|
if needTranscode:
|
|
57
65
|
needDeleteSrc, newSrc = transcode(src)
|
|
@@ -60,7 +68,7 @@ def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additiona
|
|
|
60
68
|
newSrc = src
|
|
61
69
|
|
|
62
70
|
# 根据targetDomain判断使用不同的上传逻辑
|
|
63
|
-
ossurl = uploadByDomain(newSrc, targetDomain, keepItAlways)
|
|
71
|
+
ossurl = uploadByDomain(newSrc, targetDomain, taskUUID, keepItAlways=keepItAlways, uploadPath=uploadPath)
|
|
64
72
|
|
|
65
73
|
if additionalUrl:
|
|
66
74
|
ossurl = additionalUrl(newSrc, ossurl)
|
|
@@ -68,7 +76,7 @@ def upload(src, taskUUID=None, needTranscode=True, keepItAlways=False, additiona
|
|
|
68
76
|
os.remove(newSrc)
|
|
69
77
|
return ossurl
|
|
70
78
|
|
|
71
|
-
def uploadByDomain(src, targetDomain, keepItAlways=False):
|
|
79
|
+
def uploadByDomain(src, targetDomain, taskUUID, keepItAlways=False, uploadPath=None):
|
|
72
80
|
import os
|
|
73
81
|
from pathlib import Path
|
|
74
82
|
import uuid
|
|
@@ -79,6 +87,12 @@ def uploadByDomain(src, targetDomain, keepItAlways=False):
|
|
|
79
87
|
new_file_name = ''.join(str(uuid.uuid4()).split('-'))
|
|
80
88
|
|
|
81
89
|
parsed_domain, upload_path = parseDomainAndPath(targetDomain)
|
|
90
|
+
if uploadPath:
|
|
91
|
+
upload_path = uploadPath
|
|
92
|
+
if isMecordConfig(parsed_domain):
|
|
93
|
+
from mecord import upload as mecord_upload
|
|
94
|
+
return mecord_upload.upload(src, taskUUID)
|
|
95
|
+
|
|
82
96
|
oss_config = getOssConfig(parsed_domain)
|
|
83
97
|
if oss_config:
|
|
84
98
|
return uploadToOss(src, f"{new_file_name}.{ext}", oss_config, upload_path)
|
|
@@ -239,6 +253,24 @@ oss_template_config = {
|
|
|
239
253
|
"domain": "https://oss.zjtemplate.com"
|
|
240
254
|
}
|
|
241
255
|
|
|
256
|
+
def match_wildcard_domain(target_domain, pattern):
|
|
257
|
+
if pattern.startswith("*."):
|
|
258
|
+
suffix = pattern[1:] # 去掉 "*." 前缀
|
|
259
|
+
return target_domain.endswith(suffix)
|
|
260
|
+
return target_domain == pattern
|
|
261
|
+
|
|
262
|
+
def get_domain_config(target_domain):
|
|
263
|
+
# 首先尝试精确匹配
|
|
264
|
+
if target_domain in DOMAIN_CONFIG:
|
|
265
|
+
return DOMAIN_CONFIG[target_domain]
|
|
266
|
+
|
|
267
|
+
# 然后尝试通配符匹配
|
|
268
|
+
for pattern, config in DOMAIN_CONFIG.items():
|
|
269
|
+
if match_wildcard_domain(target_domain, pattern):
|
|
270
|
+
return config
|
|
271
|
+
|
|
272
|
+
return None
|
|
273
|
+
|
|
242
274
|
DOMAIN_CONFIG = {
|
|
243
275
|
"192.168.50.12": {"type": "ftp", "config": ftp_192_168_50_12},
|
|
244
276
|
"183.6.90.205": {"type": "ftp", "config": ftp_183_6_90_205},
|
|
@@ -247,6 +279,8 @@ DOMAIN_CONFIG = {
|
|
|
247
279
|
"res.zjtemplate.com": {"type": "oss", "config": oss_res_config},
|
|
248
280
|
"upload.zjtemplate.com": {"type": "oss", "config": oss_upload_config},
|
|
249
281
|
"oss.zjtemplate.com": {"type": "oss", "config": oss_template_config},
|
|
282
|
+
"*.mecoai.cn": {"type": "mecord-cli", "config": {}},
|
|
283
|
+
"*.mecordai.com": {"type": "mecord-cli", "config": {}},
|
|
250
284
|
}
|
|
251
285
|
|
|
252
286
|
SUBDOMAIN = {
|
|
@@ -261,13 +295,21 @@ SUBDOMAIN = {
|
|
|
261
295
|
}
|
|
262
296
|
|
|
263
297
|
def getOssConfig(targetDomain):
|
|
264
|
-
|
|
265
|
-
|
|
298
|
+
config = get_domain_config(targetDomain)
|
|
299
|
+
if config and config["type"] == "oss":
|
|
300
|
+
return config["config"]
|
|
266
301
|
return None
|
|
267
302
|
|
|
303
|
+
def isMecordConfig(targetDomain):
|
|
304
|
+
config = get_domain_config(targetDomain)
|
|
305
|
+
if config and config["type"] == "mecord-cli":
|
|
306
|
+
return True
|
|
307
|
+
return False
|
|
308
|
+
|
|
268
309
|
def getFtpConfig(targetDomain):
|
|
269
|
-
|
|
270
|
-
|
|
310
|
+
config = get_domain_config(targetDomain)
|
|
311
|
+
if config and config["type"] == "ftp":
|
|
312
|
+
return config["config"]
|
|
271
313
|
return None
|
|
272
314
|
|
|
273
315
|
def getSubdomain(targetDomain):
|
|
@@ -300,6 +342,14 @@ def getFirstSupportSubdomain():
|
|
|
300
342
|
for domain, config in DOMAIN_CONFIG.items():
|
|
301
343
|
if config["type"] == "oss":
|
|
302
344
|
return {"type": "oss", "config": config["config"], "domain": config["config"]["domain"]}
|
|
345
|
+
if config["type"] == "mecord-cli":
|
|
346
|
+
# 对于通配符域名,返回一个示例域名
|
|
347
|
+
if domain.startswith("*."):
|
|
348
|
+
# 将 *.mecoai.cn 转换为 example.mecoai.cn
|
|
349
|
+
example_domain = "example" + domain[1:]
|
|
350
|
+
return {"type": "mecord-cli", "config": {}, "domain": example_domain}
|
|
351
|
+
else:
|
|
352
|
+
return {"type": "mecord-cli", "config": {}, "domain": domain}
|
|
303
353
|
elif config["type"] == "ftp":
|
|
304
354
|
ftp_config = config["config"]
|
|
305
355
|
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.5
|
|
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.5"
|
|
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
|