1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Add preference to ignore large files, close #430

This commit is contained in:
2021-08-27 05:35:54 -05:00
parent 809116c764
commit 3045361243
5 changed files with 87 additions and 4 deletions

View File

@@ -166,6 +166,10 @@ class DupeGuru(QObject):
self.model.options["match_similar_words"] = self.prefs.match_similar
threshold = self.prefs.small_file_threshold if self.prefs.ignore_small_files else 0
self.model.options["size_threshold"] = threshold * 1024 # threshold is in KB. The scanner wants bytes
large_threshold = self.prefs.large_file_threshold if self.prefs.ignore_large_files else 0
self.model.options["large_size_threshold"] = (
large_threshold * 1024 * 1024
) # threshold is in MB. The Scanner wants bytes
big_file_size_threshold = self.prefs.big_file_size_threshold if self.prefs.big_file_partial_hashes else 0
self.model.options["big_file_size_threshold"] = (
big_file_size_threshold

View File

@@ -72,6 +72,8 @@ class Preferences(PreferencesBase):
self.match_similar = get("MatchSimilar", self.match_similar)
self.ignore_small_files = get("IgnoreSmallFiles", self.ignore_small_files)
self.small_file_threshold = get("SmallFileThreshold", self.small_file_threshold)
self.ignore_large_files = get("IgnoreLargeFiles", self.ignore_large_files)
self.large_file_threshold = get("LargeFileThreshold", self.large_file_threshold)
self.big_file_partial_hashes = get("BigFilePartialHashes", self.big_file_partial_hashes)
self.big_file_size_threshold = get("BigFileSizeThreshold", self.big_file_size_threshold)
self.scan_tag_track = get("ScanTagTrack", self.scan_tag_track)
@@ -119,6 +121,8 @@ class Preferences(PreferencesBase):
self.match_similar = False
self.ignore_small_files = True
self.small_file_threshold = 10 # KB
self.ignore_large_files = False
self.large_file_threshold = 1000 # MB
self.big_file_partial_hashes = False
self.big_file_size_threshold = 100 # MB
self.scan_tag_track = False
@@ -167,6 +171,8 @@ class Preferences(PreferencesBase):
set_("MatchSimilar", self.match_similar)
set_("IgnoreSmallFiles", self.ignore_small_files)
set_("SmallFileThreshold", self.small_file_threshold)
set_("IgnoreLargeFiles", self.ignore_large_files)
set_("LargeFileThreshold", self.large_file_threshold)
set_("BigFilePartialHashes", self.big_file_partial_hashes)
set_("BigFileSizeThreshold", self.big_file_size_threshold)
set_("ScanTagTrack", self.scan_tag_track)

View File

@@ -64,6 +64,21 @@ class PreferencesDialog(PreferencesDialogBase):
spacer_item1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacer_item1)
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
self.horizontalLayout_2a = QHBoxLayout()
self._setupAddCheckbox("ignoreLargeFilesBox", tr("Ignore files larger than"), self.widget)
self.horizontalLayout_2a.addWidget(self.ignoreLargeFilesBox)
self.sizeSaturationSpinBox = QSpinBox(self.widget)
size_policy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
self.sizeSaturationSpinBox.setSizePolicy(size_policy)
self.sizeSaturationSpinBox.setMaximumSize(QSize(100, 16777215))
self.sizeSaturationSpinBox.setRange(0, 1000000)
self.horizontalLayout_2a.addWidget(self.sizeSaturationSpinBox)
self.label_6a = QLabel(self.widget)
self.label_6a.setText(tr("MB"))
self.horizontalLayout_2a.addWidget(self.label_6a)
spacer_item3 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalLayout_2a.addItem(spacer_item3)
self.verticalLayout_4.addLayout(self.horizontalLayout_2a)
self.horizontalLayout_2b = QHBoxLayout()
self._setupAddCheckbox(
"bigFilePartialHashesBox",
@@ -98,6 +113,8 @@ class PreferencesDialog(PreferencesDialogBase):
setchecked(self.wordWeightingBox, prefs.word_weighting)
setchecked(self.ignoreSmallFilesBox, prefs.ignore_small_files)
self.sizeThresholdSpinBox.setValue(prefs.small_file_threshold)
setchecked(self.ignoreLargeFilesBox, prefs.ignore_large_files)
self.sizeSaturationSpinBox.setValue(prefs.large_file_threshold)
setchecked(self.bigFilePartialHashesBox, prefs.big_file_partial_hashes)
self.bigSizeThresholdSpinBox.setValue(prefs.big_file_size_threshold)
@@ -113,5 +130,7 @@ class PreferencesDialog(PreferencesDialogBase):
prefs.word_weighting = ischecked(self.wordWeightingBox)
prefs.ignore_small_files = ischecked(self.ignoreSmallFilesBox)
prefs.small_file_threshold = self.sizeThresholdSpinBox.value()
prefs.ignore_large_files = ischecked(self.ignoreLargeFilesBox)
prefs.large_file_threshold = self.sizeSaturationSpinBox.value()
prefs.big_file_partial_hashes = ischecked(self.bigFilePartialHashesBox)
prefs.big_file_size_threshold = self.bigSizeThresholdSpinBox.value()