fix: 判断文件是否存在

This commit is contained in:
ymm 2025-02-19 21:36:51 +08:00
parent ccb16fd24e
commit fc42888f5a
1 changed files with 3 additions and 0 deletions

View File

@ -373,6 +373,9 @@ class VodToLocalNode:
# 生成一个临时目录路径名并创建该目录
self.create_directory(os.path.join(os.path.dirname(os.path.abspath(__file__)), "download", f"{sub_app_id}"))
output_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "download", f"{sub_app_id}", f"{file_id}.mp4" )
# 判断文件是否存在
if os.path.exists(output_dir):
return output_dir
return self._download_file(url=media_url, save_path=output_dir, timeout=60 * 10)
def _download_file(self, url: str, save_path: str, timeout: int=30):