mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
[#22 state:fixed] Error-proofed the path2iphoto query and added more progress feedback to the iphoto deletion process.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%407
This commit is contained in:
parent
c08fc8b911
commit
7f9895e806
@ -145,19 +145,24 @@ class DupeGuruPE(app_cocoa.DupeGuru):
|
|||||||
marked = [dupe for dupe in self.results.dupes if self.results.is_marked(dupe)]
|
marked = [dupe for dupe in self.results.dupes if self.results.is_marked(dupe)]
|
||||||
self.path2iphoto = {}
|
self.path2iphoto = {}
|
||||||
if any(isinstance(dupe, IPhoto) for dupe in marked):
|
if any(isinstance(dupe, IPhoto) for dupe in marked):
|
||||||
|
j = j.start_subjob([6, 4], "Probing iPhoto. Don\'t touch it during the operation!")
|
||||||
a = app('iPhoto')
|
a = app('iPhoto')
|
||||||
a.select(a.photo_library_album())
|
a.select(a.photo_library_album())
|
||||||
photos = as_fetch(a.photo_library_album().photos, k.item)
|
photos = as_fetch(a.photo_library_album().photos, k.item)
|
||||||
for photo in photos:
|
for photo in j.iter_with_progress(photos):
|
||||||
self.path2iphoto[photo.image_path()] = photo
|
self.path2iphoto[unicode(photo.image_path())] = photo
|
||||||
|
j.start_job(self.results.mark_count, "Sending dupes to the Trash")
|
||||||
self.last_op_error_count = self.results.perform_on_marked(op, True)
|
self.last_op_error_count = self.results.perform_on_marked(op, True)
|
||||||
del self.path2iphoto
|
del self.path2iphoto
|
||||||
|
|
||||||
def _do_delete_dupe(self, dupe):
|
def _do_delete_dupe(self, dupe):
|
||||||
if isinstance(dupe, IPhoto):
|
if isinstance(dupe, IPhoto):
|
||||||
|
if unicode(dupe.path) in self.path2iphoto:
|
||||||
photo = self.path2iphoto[unicode(dupe.path)]
|
photo = self.path2iphoto[unicode(dupe.path)]
|
||||||
app('iPhoto').remove(photo)
|
app('iPhoto').remove(photo)
|
||||||
return True
|
return True
|
||||||
|
else:
|
||||||
|
logging.warning("Could not find photo {0} in iPhoto Library", unicode(dupe.path))
|
||||||
else:
|
else:
|
||||||
return app_cocoa.DupeGuru._do_delete_dupe(self, dupe)
|
return app_cocoa.DupeGuru._do_delete_dupe(self, dupe)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user