mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 06:37:17 +00:00
Merge pull request #908 from glubsy/hash_sample_optimization
Hash sample optimization
This commit is contained in:
@@ -187,7 +187,14 @@ class DupeGuru(QObject):
|
||||
)
|
||||
self.model.options["size_threshold"] = (
|
||||
threshold * 1024
|
||||
) # threshold is in KB. the scanner wants bytes
|
||||
) # threshold is in KB. 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 * 1024 * 1024
|
||||
# threshold is in MiB. The scanner wants bytes
|
||||
)
|
||||
scanned_tags = set()
|
||||
if self.prefs.scan_tag_track:
|
||||
scanned_tags.add("track")
|
||||
|
||||
@@ -73,6 +73,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.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)
|
||||
self.scan_tag_artist = get("ScanTagArtist", self.scan_tag_artist)
|
||||
self.scan_tag_album = get("ScanTagAlbum", self.scan_tag_album)
|
||||
@@ -117,6 +119,8 @@ class Preferences(PreferencesBase):
|
||||
self.match_similar = False
|
||||
self.ignore_small_files = True
|
||||
self.small_file_threshold = 10 # KB
|
||||
self.big_file_partial_hashes = False
|
||||
self.big_file_size_threshold = 100 # MB
|
||||
self.scan_tag_track = False
|
||||
self.scan_tag_artist = True
|
||||
self.scan_tag_album = True
|
||||
@@ -161,6 +165,8 @@ class Preferences(PreferencesBase):
|
||||
set_("MatchSimilar", self.match_similar)
|
||||
set_("IgnoreSmallFiles", self.ignore_small_files)
|
||||
set_("SmallFileThreshold", self.small_file_threshold)
|
||||
set_("BigFilePartialHashes", self.big_file_partial_hashes)
|
||||
set_("BigFileSizeThreshold", self.big_file_size_threshold)
|
||||
set_("ScanTagTrack", self.scan_tag_track)
|
||||
set_("ScanTagArtist", self.scan_tag_artist)
|
||||
set_("ScanTagAlbum", self.scan_tag_album)
|
||||
|
||||
@@ -72,6 +72,21 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
spacerItem1 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2.addItem(spacerItem1)
|
||||
self.verticalLayout_4.addLayout(self.horizontalLayout_2)
|
||||
self.horizontalLayout_2b = QHBoxLayout()
|
||||
self._setupAddCheckbox(
|
||||
"bigFilePartialHashesBox", tr("Partially hash files bigger than"), self.widget
|
||||
)
|
||||
self.horizontalLayout_2b.addWidget(self.bigFilePartialHashesBox)
|
||||
self.bigSizeThresholdEdit = QLineEdit(self.widget)
|
||||
self.bigSizeThresholdEdit.setSizePolicy(sizePolicy)
|
||||
self.bigSizeThresholdEdit.setMaximumSize(QSize(75, 16777215))
|
||||
self.horizontalLayout_2b.addWidget(self.bigSizeThresholdEdit)
|
||||
self.label_6b = QLabel(self.widget)
|
||||
self.label_6b.setText(tr("MB"))
|
||||
self.horizontalLayout_2b.addWidget(self.label_6b)
|
||||
spacerItem2 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
||||
self.horizontalLayout_2b.addItem(spacerItem2)
|
||||
self.verticalLayout_4.addLayout(self.horizontalLayout_2b)
|
||||
self._setupAddCheckbox(
|
||||
"ignoreHardlinkMatches",
|
||||
tr("Ignore duplicates hardlinking to the same file"),
|
||||
@@ -90,6 +105,8 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
setchecked(self.wordWeightingBox, prefs.word_weighting)
|
||||
setchecked(self.ignoreSmallFilesBox, prefs.ignore_small_files)
|
||||
self.sizeThresholdEdit.setText(str(prefs.small_file_threshold))
|
||||
setchecked(self.bigFilePartialHashesBox, prefs.big_file_partial_hashes)
|
||||
self.bigSizeThresholdEdit.setText(str(prefs.big_file_size_threshold))
|
||||
|
||||
# Update UI state based on selected scan type
|
||||
scan_type = prefs.get_scan_type(AppMode.Standard)
|
||||
@@ -103,3 +120,5 @@ class PreferencesDialog(PreferencesDialogBase):
|
||||
prefs.word_weighting = ischecked(self.wordWeightingBox)
|
||||
prefs.ignore_small_files = ischecked(self.ignoreSmallFilesBox)
|
||||
prefs.small_file_threshold = tryint(self.sizeThresholdEdit.text())
|
||||
prefs.big_file_partial_hashes = ischecked(self.bigFilePartialHashesBox)
|
||||
prefs.big_file_size_threshold = tryint(self.bigSizeThresholdEdit.text())
|
||||
|
||||
Reference in New Issue
Block a user