コード例 #1
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def start_scanning(self):
     if self.directories.has_iphoto_path():
         try:
             app("iPhoto")
         except ApplicationNotFoundError:
             self.view.show_message(tr("The iPhoto application couldn't be found."))
             return
     DupeGuruBase.start_scanning(self)
コード例 #2
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def start_scanning(self):
     if self.directories.has_iphoto_path():
         try:
             app('iPhoto')
         except ApplicationNotFoundError:
             self.view.show_message(
                 tr("The iPhoto application couldn't be found."))
             return
     DupeGuruBase.start_scanning(self)
コード例 #3
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def _job_completed(self, jobid):
     DupeGuruBase._job_completed(self, jobid)
     if jobid == JobType.Load:
         if hasattr(self, "path2iphoto"):
             del self.path2iphoto
         if hasattr(self, "path2aperture"):
             del self.path2aperture
     if jobid == JobType.Delete and self.deleted_aperture_photos:
         msg = tr('Deleted Aperture photos were sent to a project called "dupeGuru Trash".')
         self.view.show_message(msg)
コード例 #4
0
ファイル: app_pe.py プロジェクト: astrofrog/dupeguru
 def _job_completed(self, jobid, exc):
     DupeGuruBase._job_completed(self, jobid, exc)
     if jobid == JobType.Load:
         if hasattr(self, 'path2iphoto'):
             del self.path2iphoto
         if hasattr(self, 'path2aperture'):
             del self.path2aperture
     if jobid == JobType.Delete and self.deleted_aperture_photos:
         msg = tr("Deleted Aperture photos were sent to a project called \"dupeGuru Trash\".")
         self.view.show_message(msg)
コード例 #5
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def _job_completed(self, jobid):
     DupeGuruBase._job_completed(self, jobid)
     if jobid == JobType.Load:
         if hasattr(self, 'path2iphoto'):
             del self.path2iphoto
         if hasattr(self, 'path2aperture'):
             del self.path2aperture
     if jobid == JobType.Delete and self.deleted_aperture_photos:
         msg = tr(
             "Deleted Aperture photos were sent to a project called \"dupeGuru Trash\"."
         )
         self.view.show_message(msg)
コード例 #6
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def _do_delete_dupe(self, dupe, *args):
     if isinstance(dupe, IPhoto):
         try:
             a = app('iPhoto')
             album = a.photo_library_album()
             if album is None:
                 msg = "There are communication problems with iPhoto. Try opening iPhoto first, it might solve it."
                 raise EnvironmentError(msg)
             [photo] = album.photos[its.image_path == str(dupe.path)]()
             a.remove(photo, timeout=0)
         except ValueError:
             msg = "Could not find photo '{}' in iPhoto Library".format(
                 str(dupe.path))
             raise EnvironmentError(msg)
         except (CommandError, RuntimeError) as e:
             raise EnvironmentError(str(e))
     if isinstance(dupe, AperturePhoto):
         try:
             a = app('Aperture')
             # I'm flying blind here. In my own test library, all photos are in an album with the
             # id "LibraryFolder", so I'm going to guess that it's the case at least most of the
             # time. As a safeguard, if we don't find any library with that id, we'll use the
             # first album.
             # Now, about deleting: All attempts I've made at sending photos to trash failed,
             # even with normal applescript. So, what we're going to do here is to create a
             # "dupeGuru Trash" project and tell the user to manually send those photos to trash.
             libraries = a.libraries()
             library = first(l for l in libraries
                             if l.id == 'LibraryFolder')
             if library is None:
                 library = libraries[0]
             trash_project = a.projects["dupeGuru Trash"]
             if trash_project.exists():
                 trash_project = trash_project()
             else:
                 trash_project = library.make(
                     new=k.project,
                     with_properties={k.name: "dupeGuru Trash"})
             [photo] = library.image_versions[its.id == dupe.db_id]()
             photo.move(to=trash_project)
         except (IndexError, ValueError):
             msg = "Could not find photo '{}' in Aperture Library".format(
                 str(dupe.path))
             raise EnvironmentError(msg)
         except (CommandError, RuntimeError) as e:
             raise EnvironmentError(str(e))
     else:
         DupeGuruBase._do_delete_dupe(self, dupe, *args)
コード例 #7
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def _do_delete_dupe(self, dupe, *args):
     if isinstance(dupe, IPhoto):
         try:
             a = app("iPhoto")
             album = a.photo_library_album()
             if album is None:
                 msg = "There are communication problems with iPhoto. Try opening iPhoto first, it might solve it."
                 raise EnvironmentError(msg)
             [photo] = album.photos[its.image_path == str(dupe.path)]()
             a.remove(photo, timeout=0)
         except ValueError:
             msg = "Could not find photo '{}' in iPhoto Library".format(str(dupe.path))
             raise EnvironmentError(msg)
         except (CommandError, RuntimeError) as e:
             raise EnvironmentError(str(e))
     if isinstance(dupe, AperturePhoto):
         try:
             a = app("Aperture")
             # I'm flying blind here. In my own test library, all photos are in an album with the
             # id "LibraryFolder", so I'm going to guess that it's the case at least most of the
             # time. As a safeguard, if we don't find any library with that id, we'll use the
             # first album.
             # Now, about deleting: All attempts I've made at sending photos to trash failed,
             # even with normal applescript. So, what we're going to do here is to create a
             # "dupeGuru Trash" project and tell the user to manually send those photos to trash.
             libraries = a.libraries()
             library = first(l for l in libraries if l.id == "LibraryFolder")
             if library is None:
                 library = libraries[0]
             trash_project = a.projects["dupeGuru Trash"]
             if trash_project.exists():
                 trash_project = trash_project()
             else:
                 trash_project = library.make(new=k.project, with_properties={k.name: "dupeGuru Trash"})
             [photo] = library.image_versions[its.id == dupe.db_id]()
             photo.move(to=trash_project)
         except (IndexError, ValueError):
             msg = "Could not find photo '{}' in Aperture Library".format(str(dupe.path))
             raise EnvironmentError(msg)
         except (CommandError, RuntimeError) as e:
             raise EnvironmentError(str(e))
     else:
         DupeGuruBase._do_delete_dupe(self, dupe, *args)
コード例 #8
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def _create_file(self, path):
     if (self.directories.iphoto_libpath is not None) and (path in self.directories.iphoto_libpath[:-1]):
         if not hasattr(self, "path2iphoto"):
             photos = get_iphoto_pictures(self.directories.iphoto_libpath)
             self.path2iphoto = {p.path: p for p in photos}
         return self.path2iphoto.get(path)
     if (self.directories.aperture_libpath is not None) and (path in self.directories.aperture_libpath[:-1]):
         if not hasattr(self, "path2aperture"):
             photos = get_aperture_pictures(self.directories.aperture_libpath)
             self.path2aperture = {p.path: p for p in photos}
         return self.path2aperture.get(path)
     return DupeGuruBase._create_file(self, path)
コード例 #9
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def _create_file(self, path):
     if (self.directories.iphoto_libpath
             is not None) and (path
                               in self.directories.iphoto_libpath.parent()):
         if not hasattr(self, 'path2iphoto'):
             photos = get_iphoto_pictures(self.directories.iphoto_libpath)
             self.path2iphoto = {p.path: p for p in photos}
         return self.path2iphoto.get(path)
     if (self.directories.aperture_libpath is not None) and (
             path in self.directories.aperture_libpath.parent()):
         if not hasattr(self, 'path2aperture'):
             photos = get_aperture_pictures(
                 self.directories.aperture_libpath)
             self.path2aperture = {p.path: p for p in photos}
         return self.path2aperture.get(path)
     return DupeGuruBase._create_file(self, path)
コード例 #10
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def copy_or_move(self, dupe, copy, destination, dest_type):
     if isinstance(dupe, (IPhoto, AperturePhoto)):
         copy = True
     return DupeGuruBase.copy_or_move(self, dupe, copy, destination,
                                      dest_type)
コード例 #11
0
ファイル: app_pe.py プロジェクト: legwak/dupeguru
 def __init__(self, view):
     DupeGuruBase.__init__(self, view)
     self.directories = Directories()
コード例 #12
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def copy_or_move(self, dupe, copy, destination, dest_type):
     if isinstance(dupe, (IPhoto, AperturePhoto)):
         copy = True
     return DupeGuruBase.copy_or_move(self, dupe, copy, destination, dest_type)
コード例 #13
0
ファイル: app_pe.py プロジェクト: James-A-White/dupeguru
 def __init__(self, view, appdata):
     appdata = op.join(appdata, "dupeGuru Picture Edition")
     DupeGuruBase.__init__(self, view, appdata)
     self.directories = Directories()
コード例 #14
0
ファイル: app_pe.py プロジェクト: badcure/dupeguru
 def __init__(self, view):
     DupeGuruBase.__init__(self, view)
     self.directories = Directories()
コード例 #15
0
ファイル: app_pe.py プロジェクト: silvavlis/dupeguru
 def __init__(self, view):
     DupeGuruBase.__init__(self, view)
     self.fileclasses = [Photo]
コード例 #16
0
 def __init__(self, view, appdata):
     appdata = op.join(appdata, 'dupeGuru Picture Edition')
     DupeGuruBase.__init__(self, view, appdata)
     self.directories = Directories()