Skip to content

Commit

Permalink
delete clean snapshot when duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
blakeblackshear committed Oct 2, 2021
1 parent 7bf7365 commit de811b7
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frigate/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ def purge_duplicates(self):
for event in duplicate_events:
logger.debug(f"Removing duplicate: {event.id}")
media_name = f"{event.camera}-{event.id}"
if event.has_snapshot:
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}.jpg")
media_path.unlink(missing_ok=True)
if event.has_clip:
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}.mp4")
media_path.unlink(missing_ok=True)
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}.jpg")
media_path.unlink(missing_ok=True)
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}-clean.png")
media_path.unlink(missing_ok=True)
media_path = Path(f"{os.path.join(CLIPS_DIR, media_name)}.mp4")
media_path.unlink(missing_ok=True)

(
Event.delete()
Expand Down

0 comments on commit de811b7

Please sign in to comment.