vs = glob.glob(f_img_d)
vs = sorted(vs, key=lambda i: os.path.getmtime(i), reverse=True)
myp, myp_num = 2, 3 ep = ep_outer while True: vs = glob.glob(f_img_d) vs = sorted(vs, key=lambda i: os.path.getmtime(i), reverse=True) for i in vs: if os.path.getsize(i) / 1024 / 1024 < 0.8: continue if time.time() - os.path.getmtime(i) < 3600 * 0.0001: continue with open(i, 'rb') as fr: try: auth = oss2.Auth(kid, ks) bucket = oss2.Bucket(auth, ep, bn) nn = i.split(os_sep)[-1] s = '{}{}'.format('gen_video/', nn) dbid = nn.split('_')[0] if int(dbid) % myp_num != myp: # if int(dbid) != 49855227: continue res = bucket.put_object(s, fr.read()) logging.info(s) print(res.resp.response.url) except Exception as e: l = [str(i) for i in [e]] log_s = '||'.join(l) logging.exception(log_s) print(log_s) time.sleep(1)