[#162 state:fixed] Apply the 'Match scaled pictures' option to exif timestamp scan type.

This commit is contained in:
Virgil Dupras 2011-06-15 10:13:03 -04:00
parent 4399fe9d17
commit cd9fd3a10b
10 changed files with 21 additions and 59 deletions

View File

@ -228,7 +228,7 @@
<object class="NSButtonCell" key="NSCell" id="911281323">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents">Match scaled pictures together</string>
<string key="NSContents">Match pictures of different dimensions</string>
<reference key="NSSupport" ref="26"/>
<reference key="NSControlView" ref="722670516"/>
<int key="NSButtonFlags">1211912703</int>
@ -984,26 +984,6 @@
</object>
<int key="connectionID">98</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: values.scanType</string>
<reference key="source" ref="722670516"/>
<reference key="destination" ref="455472712"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="722670516"/>
<reference key="NSDestination" ref="455472712"/>
<string key="NSLabel">enabled: values.scanType</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">values.scanType</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSValueTransformerName</string>
<string key="NS.object.0">vtScanTypeIsFuzzy</string>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">

View File

@ -29,7 +29,7 @@
/* Class = "NSMenuItem"; title = "Right in destination"; ObjectID = "30"; */
"30.title" = "Directement à la destination";
/* Class = "NSButtonCell"; title = "Match scaled pictures together"; ObjectID = "31"; */
/* Class = "NSButtonCell"; title = "Match pictures of different dimensions"; ObjectID = "31"; */
"31.title" = "Comparer les images de tailles différentes";
/* Class = "NSButtonCell"; title = "Automatically check for updates"; ObjectID = "32"; */

View File

@ -209,7 +209,7 @@
<reference key="NSControlView" ref="488256664"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<object class="NSCustomResource" key="NSNormalImage" id="745366445">
<object class="NSCustomResource" key="NSNormalImage" id="949163782">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSSwitch</string>
</object>
@ -236,7 +236,7 @@
<reference key="NSControlView" ref="722670516"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -258,7 +258,7 @@
<reference key="NSControlView" ref="472028782"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -280,7 +280,7 @@
<reference key="NSControlView" ref="279087998"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -479,7 +479,7 @@
<reference key="NSControlView" ref="1018598123"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -501,7 +501,7 @@
<reference key="NSControlView" ref="519470955"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -523,7 +523,7 @@
<reference key="NSControlView" ref="606836304"/>
<int key="NSButtonFlags">1211912703</int>
<int key="NSButtonFlags2">2</int>
<reference key="NSNormalImage" ref="745366445"/>
<reference key="NSNormalImage" ref="949163782"/>
<reference key="NSAlternateImage" ref="990345653"/>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
@ -992,26 +992,6 @@
</object>
<int key="connectionID">98</int>
</object>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">enabled: values.scanType</string>
<reference key="source" ref="722670516"/>
<reference key="destination" ref="455472712"/>
<object class="NSNibBindingConnector" key="connector">
<reference key="NSSource" ref="722670516"/>
<reference key="NSDestination" ref="455472712"/>
<string key="NSLabel">enabled: values.scanType</string>
<string key="NSBinding">enabled</string>
<string key="NSKeyPath">values.scanType</string>
<object class="NSDictionary" key="NSOptions">
<string key="NS.key.0">NSValueTransformerName</string>
<string key="NS.object.0">vtScanTypeIsFuzzy</string>
</object>
<int key="NSNibBindingConnectorVersion">2</int>
</object>
</object>
<int key="connectionID">100</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">

View File

@ -16,7 +16,7 @@ from hscommon.trans import tr
from core.engine import Match
from . import exif
def getmatches(files, j):
def getmatches(files, match_scaled, j):
timestamp2pic = defaultdict(set)
for picture in j.iter_with_progress(files, tr("Read EXIF of %d/%d pictures")):
try:
@ -30,5 +30,8 @@ def getmatches(files, j):
del timestamp2pic['0000:00:00 00:00:00']
matches = []
for pictures in timestamp2pic.values():
matches += [Match(p1, p2, 100) for p1, p2 in combinations(pictures, 2)]
for p1, p2 in combinations(pictures, 2):
if (not match_scaled) and (p1.dimensions != p2.dimensions):
continue
matches.append(Match(p1, p2, 100))
return matches

View File

@ -20,7 +20,7 @@ class ScannerPE(Scanner):
if self.scan_type == ScanType.FuzzyBlock:
return matchblock.getmatches(files, self.cache_path, self.threshold, self.match_scaled, j)
elif self.scan_type == ScanType.ExifTimestamp:
return matchexif.getmatches(files, j)
return matchexif.getmatches(files, self.match_scaled, j)
else:
raise Exception("Invalid scan type")

View File

@ -32,11 +32,11 @@ Preferences
.. only:: edition_pe
**Scan Type:** This option determines the type of scan that will be made on your pictures. The **Contents** scan type compares the actual contents of the pictures in a fuzzy way (making it possible to find not only exact duplicates, but also similar ones). The **EXIF Timestamp** scan type looks at the EXIF metadata of the picture (if it exists) and matches pictures that have the same one. It's much faster than the Contents scan.
**Scan Type:** This option determines the type of scan that will be made on your pictures. The **Contents** scan type compares the actual contents of the pictures in a fuzzy way (making it possible to find not only exact duplicates, but also similar ones). The **EXIF Timestamp** scan type looks at the EXIF metadata of the picture (if it exists) and matches pictures that have the same one. It's much faster than the Contents scan. **Warning:** Modified pictures often keep the same EXIF timestamp, so watch out for false positives when you use that scan type.
**Filter Hardness:** *Contents scan type only.* The higher is this setting, the "harder" is the filter (In other words, the less results you get). Most pictures of the same quality match at 100% even if the format is different (PNG and JPG for example.). However, if you want to make a PNG match with a lower quality JPG, you will have to set the filer hardness to lower than 100. The default, 95, is a sweet spot.
**Match scaled pictures together:** *Contents scan type only.* If you check this box, pictures of different dimensions will be allowed in the same duplicate group.
**Match pictures of different dimensions:** If you check this box, pictures of different dimensions will be allowed in the same duplicate group.
**Can mix file kind:** If you check this box, duplicate groups are allowed to have files with different extensions. If you don't check it, well, they aren't!

View File

@ -32,11 +32,11 @@ Préférences
.. only:: edition_pe
**Type de scan:** Détermine le type de scan qui sera fait sur vos images. Le type **Contenu** compare le contenu des images de façon "fuzzy", rendant possible de trouver non seulement les doublons exactes, mais aussi les similaires. Le type **EXIF Timestamp** compare les métadonnées EXIF des images (si existantes) et détermine si le "timestamp" (moment de prise de la photo) est pareille. C'est beaucoup plus rapide que le scan par Contenu.
**Type de scan:** Détermine le type de scan qui sera fait sur vos images. Le type **Contenu** compare le contenu des images de façon "fuzzy", rendant possible de trouver non seulement les doublons exactes, mais aussi les similaires. Le type **EXIF Timestamp** compare les métadonnées EXIF des images (si existantes) et détermine si le "timestamp" (moment de prise de la photo) est pareille. C'est beaucoup plus rapide que le scan par Contenu. **Attention:** Les photos modifiées gardent souvent le même timestamp, donc faites attention aux faux doublons si vous utilisez cette méthode.
**Seuil du filtre:** *Scan par Contenu seulement.* Plus il est élevé, plus les images doivent être similaires pour être considérées comme des doublons. Le défaut de 95% permet quelques petites différence, comme par exemple une différence de qualité ou bien une légère modification des couleurs.
**Comparer les images de tailles différentes:** *Scan par Contenu seulement.* Le nom dit tout. Sans cette option, les images de tailles différentes ne sont pas comparées.
**Comparer les images de tailles différentes:** Le nom dit tout. Sans cette option, les images de tailles différentes ne sont pas comparées.
**Comparer les fichiers de différents types:** Sans cette option, seulement les fichiers du même type seront comparés.

View File

@ -530,7 +530,7 @@
<translation>Année</translation>
</message>
<message>
<source>Match scaled pictures together</source>
<source>Match pictures of different dimensions</source>
<translation>Comparer les images de tailles différentes</translation>
</message>
<message>

View File

@ -32,7 +32,7 @@ class PreferencesDialog(PreferencesDialogBase):
self._setupScanTypeBox(scanTypeLabels)
self._setupFilterHardnessBox()
self.widgetsVLayout.addLayout(self.filterHardnessHLayout)
self._setupAddCheckbox('matchScaledBox', tr("Match scaled pictures together"))
self._setupAddCheckbox('matchScaledBox', tr("Match pictures of different dimensions"))
self.widgetsVLayout.addWidget(self.matchScaledBox)
self._setupAddCheckbox('mixFileKindBox', tr("Can mix file kind"))
self.widgetsVLayout.addWidget(self.mixFileKindBox)
@ -63,7 +63,6 @@ class PreferencesDialog(PreferencesDialogBase):
scan_type = SCAN_TYPE_ORDER[self.scanTypeComboBox.currentIndex()]
fuzzy_scan = scan_type == ScanType.FuzzyBlock
self.filterHardnessSlider.setEnabled(fuzzy_scan)
self.matchScaledBox.setEnabled(fuzzy_scan)
if __name__ == '__main__':