fix: 判断文件是否存在
This commit is contained in:
parent
ccb16fd24e
commit
fc42888f5a
|
|
@ -373,6 +373,9 @@ class VodToLocalNode:
|
||||||
# 生成一个临时目录路径名并创建该目录
|
# 生成一个临时目录路径名并创建该目录
|
||||||
self.create_directory(os.path.join(os.path.dirname(os.path.abspath(__file__)), "download", f"{sub_app_id}"))
|
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" )
|
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)
|
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):
|
def _download_file(self, url: str, save_path: str, timeout: int=30):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue