Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonoko committed Mar 27, 2024
2 parents a766daa + 0da53fa commit 424d198
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions windrecorder/ocr_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,14 +529,20 @@ def compress_outdated_videofiles(video_queue_batch=30):

if len(video_filepath_list_outdate) > 0:
for item in video_filepath_list_outdate:
if "-COMPRESS" not in item and "-OCRED" in item:
if "-COMPRESS" not in item and "-OCRED" in item and "-ERROR" not in item:
logger.info(f"compressing {item}, {video_process_count=}, {video_queue_batch=}")
record.compress_video_resolution(item, config.video_compress_rate)
send2trash(item)
video_process_count += 1
try:
record.compress_video_resolution(item, config.video_compress_rate)
send2trash(item)
video_process_count += 1
except subprocess.CalledProcessError as e:
logger.error(f"{item} seems invalid, error: {e}")
os.rename(item, item.replace("-OCRED", "-OCRED-ERROR"))
except Exception as e:
logger.error(f"{item} compress fail, error: {e}")
if video_process_count > video_queue_batch:
break
logger.info("All compress tasks done!")
logger.info("All compress tasks done!")


# 备份数据库
Expand Down

0 comments on commit 424d198

Please sign in to comment.