ryry-cli 3.1__tar.gz → 3.3__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 (27) hide show
  1. {ryry_cli-3.1 → ryry_cli-3.3}/PKG-INFO +1 -1
  2. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/constant.py +2 -2
  3. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/ryry_webapi.py +35 -8
  4. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/upload.py +1 -1
  5. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/PKG-INFO +1 -1
  6. {ryry_cli-3.1 → ryry_cli-3.3}/setup.py +1 -1
  7. {ryry_cli-3.1 → ryry_cli-3.3}/LICENSE +0 -0
  8. {ryry_cli-3.1 → ryry_cli-3.3}/README.md +0 -0
  9. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/__init__.py +0 -0
  10. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/main.py +0 -0
  11. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/ryry_server_socket.py +0 -0
  12. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/ryry_service.py +0 -0
  13. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/ryry_widget.py +0 -0
  14. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/script_template/__init__.py +0 -0
  15. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/script_template/main.py +0 -0
  16. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/script_template/run.py +0 -0
  17. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/server_func.py +0 -0
  18. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/store.py +0 -0
  19. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/task.py +0 -0
  20. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/taskUtils.py +0 -0
  21. {ryry_cli-3.1 → ryry_cli-3.3}/ryry/utils.py +0 -0
  22. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/SOURCES.txt +0 -0
  23. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/dependency_links.txt +0 -0
  24. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/entry_points.txt +0 -0
  25. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/requires.txt +0 -0
  26. {ryry_cli-3.1 → ryry_cli-3.3}/ryry_cli.egg-info/top_level.txt +0 -0
  27. {ryry_cli-3.1 → ryry_cli-3.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 3.1
3
+ Version: 3.3
4
4
  Summary: ryry tools
5
5
  Home-page: https://github.com/dalipenMedia
6
6
  Author: dalipen
@@ -1,6 +1,6 @@
1
1
  #!!!!! do not change this file !!!!!
2
- app_version="3.1"
3
- app_bulld_anchor="Noh_2025-05-20 18:24:08.511892"
2
+ app_version="3.3"
3
+ app_bulld_anchor="Noh_2025-06-06 16:43:52.111224"
4
4
  app_name="ryry-cli"
5
5
  import sys, os
6
6
  if getattr(sys, 'frozen', False):
@@ -2,6 +2,7 @@ import json, os, datetime
2
2
  import uuid, requests, calendar, time
3
3
  from requests.adapters import HTTPAdapter
4
4
  from urllib3.util.retry import Retry
5
+ from urllib.parse import urlparse, urlunparse
5
6
 
6
7
  from ryry import store, utils, taskUtils, constant, task
7
8
 
@@ -255,6 +256,22 @@ def _upload(localFilePath, ext, keep_it_always=False):
255
256
  raise Exception(f"upload fail!, reason={r2}")
256
257
  return r3
257
258
 
259
+ def _changeDomain(url, fix_domain):
260
+ parsed_url = urlparse(url)
261
+ return urlunparse(parsed_url._replace(netloc=fix_domain))
262
+ # netloc = parsed_url.netloc
263
+ # if 'meco-web-hk-beta.oss-cn-hongkong.aliyuncs.com' in netloc:
264
+ # mecord_netloc = 'oss.zjtemplate.com'
265
+ # elif 'meco-web-sg.oss-accelerate.aliyuncs.com' in netloc:
266
+ # mecord_netloc = 'oss.zjtemplate.com'
267
+ # elif 'p-template-hk.oss-cn-hongkong.aliyuncs.com' in netloc:
268
+ # mecord_netloc = 'oss.zjtemplate.com'
269
+ # elif 'p-upload-gz.oss-cn-guangzhou.aliyuncs.com' in netloc:
270
+ # mecord_netloc = 'upload.zjtemplate.com'
271
+ # elif 'mecord' in netloc:
272
+ # mecord_netloc = 'm.mecordai.com'
273
+ # mecord_url = parsed_url._replace(netloc=fix_domain)
274
+
258
275
  def upload(localFilePath, ext, keep_it_always=False):
259
276
  try:
260
277
  return _upload(localFilePath, ext, keep_it_always)
@@ -262,33 +279,35 @@ def upload(localFilePath, ext, keep_it_always=False):
262
279
  pass
263
280
  from mecord import upload as mecord_upload
264
281
  try:
265
- return mecord_upload.upload(localFilePath, None, "sg")
282
+ url = mecord_upload.upload(localFilePath, None, "sg")
283
+ return _changeDomain(url, "m.mecordai.com")
266
284
  except:
267
285
  pass
268
286
  try:
269
- return mecord_upload.upload(localFilePath, None, "test")
287
+ url = mecord_upload.upload(localFilePath, None, "test")
288
+ return _changeDomain(url, "m-beta.mecordai.com")
270
289
  except:
271
290
  pass
272
- try:
291
+ def upload_oss(localFilePath, ext, bucket, endpoint):
273
292
  import hashlib
274
293
  import hmac
275
294
  import base64
276
- timestamp = datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
295
+ timestamp = datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%S GMT")
277
296
  content_type = "application/octet-stream"
278
297
 
279
298
  random_name = ''.join(str(uuid.uuid4()).split('-'))
299
+ if ext[0:1] == ".":
300
+ ext = ext[1:]
280
301
  object_key = f"temp/{random_name}.{ext}"
281
- bucket = "p-template-hk"
282
302
  resource = f"/{bucket}/{object_key}"
283
- endpoint = "oss-cn-hongkong.aliyuncs.com"
284
303
  string_to_sign = f"PUT\n\n{content_type}\n{timestamp}\n{resource}"
285
304
  signature = base64.b64encode(
286
- hmac.new("sZDIL9uhqTgeQOkAjpbSOFm0259fwZ".encode('utf-8'), string_to_sign.encode('utf-8'), hashlib.sha1).digest()
305
+ hmac.new("2UtzA9cHnfNdZOtxLVuhM8SOz5HEdv".encode('utf-8'), string_to_sign.encode('utf-8'), hashlib.sha1).digest()
287
306
  ).decode('utf-8')
288
307
  url = f"https://{bucket}.{endpoint}/{object_key}"
289
308
  headers = {
290
309
  "Date": timestamp,
291
- "Authorization": f"OSS LTAI5t6YZQo4MZV6LWwt4Rnj:{signature}",
310
+ "Authorization": f"OSS LTAI5tLseFAXY33JA7zWDf4o:{signature}",
292
311
  "Content-Type": content_type
293
312
  }
294
313
  with open(localFilePath, "rb") as file:
@@ -296,6 +315,14 @@ def upload(localFilePath, ext, keep_it_always=False):
296
315
  response = requests.put(url, data=file_data, headers=headers)
297
316
  if response.status_code == 200:
298
317
  return url
318
+ try:
319
+ url = upload_oss(localFilePath, ext, "p-template-hk", "oss-cn-hongkong.aliyuncs.com")
320
+ return _changeDomain(url, "oss.zjtemplate.com")
321
+ except:
322
+ pass
323
+ try:
324
+ url = upload_oss(localFilePath, ext, "p-upload-gz", "oss-cn-guangzhou.aliyuncs.com")
325
+ return _changeDomain(url, "upload.zjtemplate.com")
299
326
  except:
300
327
  pass
301
328
  raise Exception("all upload target is fail!")
@@ -43,7 +43,7 @@ def additionalUrl(srcFile, ossUrl):
43
43
  except:
44
44
  return ossUrl
45
45
 
46
- def upload(src, taskUUID=None, timeout=300, needTranscode=True, keep_it_always=False):
46
+ def upload(src, taskUUID=None, needTranscode=True, keep_it_always=False):
47
47
  import os
48
48
  from pathlib import Path
49
49
  from ryry import taskUtils
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ryry-cli
3
- Version: 3.1
3
+ Version: 3.3
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 = "3.1"
6
+ ryry_version = "3.3"
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:
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