1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

change FilesDB to singleton class

move hash calculation back in to Files class
clear cache now clears hash cache in addition to picture cache
This commit is contained in:
Dobatymo
2021-10-29 12:22:12 +08:00
parent 1ea108fc2b
commit 9753afba74
5 changed files with 149 additions and 146 deletions

View File

@@ -139,7 +139,8 @@ class DupeGuru(Broadcaster):
self.discarded_file_count = 0
self.exclude_list = ExcludeList()
hash_cache_file = op.join(self.appdata, "hash_cache.db")
self.directories = directories.Directories(self.exclude_list, hash_cache_file)
fs.filesdb.connect(hash_cache_file)
self.directories = directories.Directories(self.exclude_list)
self.results = results.Results(self)
self.ignore_list = IgnoreList()
# In addition to "app-level" options, this dictionary also holds options that will be
@@ -422,6 +423,9 @@ class DupeGuru(Broadcaster):
except FileNotFoundError:
pass # we don't care
def clear_hash_cache(self):
fs.filesdb.clear()
def copy_or_move(self, dupe, copy: bool, destination: str, dest_type: DestType):
source_path = dupe.path
location_path = first(p for p in self.directories if dupe.path in p)
@@ -753,6 +757,9 @@ class DupeGuru(Broadcaster):
self.exclude_list.save_to_xml(p)
self.notify("save_session")
def close(self):
fs.filesdb.close()
def save_as(self, filename):
"""Save results in ``filename``.