detects duplicates before storing, eg: wacz getting media already fetched by another archiver

This commit is contained in:
msramalho
2023-07-28 10:51:48 +01:00
parent fc93ebaba0
commit 7a5c9c65bd
2 changed files with 25 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ class HashEnricher(Enricher):
if len(hd := self.calculate_hash(m.filename)):
to_enrich.media[i].set("hash", f"{self.algorithm}:{hd}")
def calculate_hash(self, filename):
def calculate_hash(self, filename) -> str:
hash = None
if self.algorithm == "SHA-256":
hash = hashlib.sha256()