diff --git a/cronjob/media/heic_to_jpeg.py b/cronjob/media/heic_to_jpeg.py index f1a5ba7..26ffe89 100644 --- a/cronjob/media/heic_to_jpeg.py +++ b/cronjob/media/heic_to_jpeg.py @@ -1,6 +1,7 @@ from pymongo import UpdateOne from lib.all import * import oss2 +from cryptography.hazmat.backends import default_backend as _default_backend service_name = 'compress' log_dir = '/app/log' @@ -37,17 +38,19 @@ class S: def proc_oen(self): # 获取所有heic图片 q = {"fmt": "image/heic"} - images = self.col_image.find(q, limit=5) + images = self.col_image.find(q, limit=1) for img in images: + print(img) old_key = safe_get_str(img, "src_id") new_key = old_key + "_h2j" arr = old_key.split("/") local_path = arr[len(arr) - 1] + ".jpeg" - ret = self.heic_to_jpg_and_save(old_key, local_path) - logger.Info("heic_to_jpg_and_save, ret: {}".format(ret)) + ret_save = self.heic_to_jpg_and_save(old_key, local_path) + logger.Info("heic_to_jpg_and_save, ret: {}".format(ret_save.resp)) + # ret_upload = self.upload_img_to_oss(local_path, new_key) s = S() s.proc_oen()