fix filenotfounderror for missing subtitles when deleting video

This commit is contained in:
simon 2022-04-08 15:56:34 +07:00
parent efa240440b
commit fe3e3cfacc
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -498,7 +498,10 @@ class YoutubeVideo(YouTubeItem, YoutubeSubtitle):
for media_url in to_del:
file_path = os.path.join(video_base, media_url)
os.remove(file_path)
try:
os.remove(file_path)
except FileNotFoundError:
print(f"{self.youtube_id}: failed {media_url}, continue.")
self.del_in_es()
self.delete_subtitles()