From 52bf351e06204dbfaa678f02363dbd9e7b3ce8e8 Mon Sep 17 00:00:00 2001 From: Edvard Rejthar Date: Wed, 6 Nov 2024 17:27:31 +0100 Subject: [PATCH] WIP --- Makefile | 6 ++++++ deduplidog/deduplidog.py | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9fbe7a5 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +export TAG := `grep version pyproject.toml | pz --search '"(\d+\.\d+\.\d+(?:rc\d+)?)?"'` + +release: + git tag $(TAG) + git push origin $(TAG) + #mkdocs gh-deploy diff --git a/deduplidog/deduplidog.py b/deduplidog/deduplidog.py index 9428599..8bc2ffa 100644 --- a/deduplidog/deduplidog.py +++ b/deduplidog/deduplidog.py @@ -342,8 +342,8 @@ def check(self): self.checksum and ("crc32", "") or ("", "crc32"))) print(f"Find files by {used}{f', ignoring: {ignored}' if ignored else ''}") - dirs_ = "" if self.same_superdir else f" at '{ - self.work_dir_name}' or the original dir at '{self.original_dir_name}'" + dirs_ = "" if self.same_superdir else \ + f" at '{self.work_dir_name}' or the original dir at '{self.original_dir_name}'" which = f"either the file from the work dir{dirs_} (whichever is bigger)" \ if self.treat_bigger_as_original \ else f"duplicates from the work dir at '{self.work_dir_name}'" @@ -626,9 +626,9 @@ def _find_similar(self, work_file: Path, candidates: list[Path]): for original in candidates: ost, wst = original.stat(), work_file.stat() if (self.ignore_date - or wst.st_mtime == ost.st_mtime - or self.tolerate_hour and self.tolerate_hour[0] <= (wst.st_mtime - ost.st_mtime)/3600 <= self.tolerate_hour[1] - ) and (self.ignore_size or wst.st_size == ost.st_size and (not self.checksum or crc(original) == crc(work_file))): + or wst.st_mtime == ost.st_mtime + or self.tolerate_hour and self.tolerate_hour[0] <= (wst.st_mtime - ost.st_mtime)/3600 <= self.tolerate_hour[1] + ) and (self.ignore_size or wst.st_size == ost.st_size and (not self.checksum or crc(original) == crc(work_file))): return original def _find_similar_media(self, work_file: Path, comparing_image: bool, candidates: list[Path]):