Пример #1
0
 def __init__(self, view, appdata):
     appdata = op.join(appdata, 'dupeGuru Music Edition')
     DupeGuruBase.__init__(self, view, appdata)
     # Use fileclasses set in DupeGuruBase.__init__()
     self.directories = Directories(
         fileclasses=self.directories.fileclasses)
     self.dead_tracks = []
Пример #2
0
 def start_scanning(self):
     if self.directories.has_itunes_path():
         try:
             app(ITUNES, terms=tunes)
         except ApplicationNotFoundError:
             self.view.show_message(tr("The iTunes application couldn't be found."))
             return
     DupeGuruBase.start_scanning(self)
Пример #3
0
 def start_scanning(self):
     if self.directories.has_itunes_path():
         try:
             app(ITUNES, terms=tunes)
         except ApplicationNotFoundError:
             self.view.show_message(tr("The iTunes application couldn't be found."))
             return
     DupeGuruBase.start_scanning(self)
Пример #4
0
 def _create_file(self, path):
     if (self.directories.itunes_libpath is not None) and (path in self.directories.itunes_libpath.parent()):
         if not hasattr(self, 'itunes_songs'):
             songs = get_itunes_songs(self.directories.itunes_libpath)
             self.itunes_songs = {song.path: song for song in songs}
         if path in self.itunes_songs:
             return self.itunes_songs[path]
         else:
             pass # We'll return the default file type, as per the last line of this method
     return DupeGuruBase._create_file(self, path)
Пример #5
0
 def _job_completed(self, jobid, exc):
     if (jobid in {JobType.RemoveDeadTracks, JobType.ScanDeadTracks}) and (exc is not None):
         msg = tr("There were communication problems with iTunes. The operation couldn't be completed.")
         self.view.show_message(msg)
         return True
     if jobid == JobType.ScanDeadTracks:
         dead_tracks_count = len(self.dead_tracks)
         if dead_tracks_count > 0:
             msg = tr("Your iTunes Library contains %d dead tracks ready to be removed. Continue?")
             if self.view.ask_yes_no(msg % dead_tracks_count):
                 self.remove_dead_tracks()
         else:
             msg = tr("You have no dead tracks in your iTunes Library")
             self.view.show_message(msg)
     if jobid == JobType.Load:
         if hasattr(self, 'itunes_songs'):
             # If we load another file, we want a refresh song list
             del self.itunes_songs
     DupeGuruBase._job_completed(self, jobid, exc)
Пример #6
0
 def _create_file(self, path):
     if (self.directories.itunes_libpath is not None) and (path in self.directories.itunes_libpath.parent()):
         if not hasattr(self, 'itunes_songs'):
             songs = get_itunes_songs(self.directories.itunes_libpath)
             self.itunes_songs = {song.path: song for song in songs}
         if path in self.itunes_songs:
             return self.itunes_songs[path]
         else:
             pass # We'll return the default file type, as per the last line of this method
     return DupeGuruBase._create_file(self, path)
Пример #7
0
 def _job_completed(self, jobid):
     # XXX Just before release, I'm realizing that this piece of code below is why I was passing
     # job exception as an argument to _job_completed(). I have to comment it for now. It's not
     # the end of the world, but I should find an elegant solution to this at some point.
     # if (jobid in {JobType.RemoveDeadTracks, JobType.ScanDeadTracks}) and (exc is not None):
     #     msg = tr("There were communication problems with iTunes. The operation couldn't be completed.")
     #     self.view.show_message(msg)
     #     return True
     if jobid == JobType.ScanDeadTracks:
         dead_tracks_count = len(self.dead_tracks)
         if dead_tracks_count > 0:
             msg = tr("Your iTunes Library contains %d dead tracks ready to be removed. Continue?")
             if self.view.ask_yes_no(msg % dead_tracks_count):
                 self.remove_dead_tracks()
         else:
             msg = tr("You have no dead tracks in your iTunes Library")
             self.view.show_message(msg)
     if jobid == JobType.Load:
         if hasattr(self, 'itunes_songs'):
             # If we load another file, we want a refresh song list
             del self.itunes_songs
     DupeGuruBase._job_completed(self, jobid)
Пример #8
0
 def _job_completed(self, jobid):
     # XXX Just before release, I'm realizing that this piece of code below is why I was passing
     # job exception as an argument to _job_completed(). I have to comment it for now. It's not
     # the end of the world, but I should find an elegant solution to this at some point.
     # if (jobid in {JobType.RemoveDeadTracks, JobType.ScanDeadTracks}) and (exc is not None):
     #     msg = tr("There were communication problems with iTunes. The operation couldn't be completed.")
     #     self.view.show_message(msg)
     #     return True
     if jobid == JobType.ScanDeadTracks:
         dead_tracks_count = len(self.dead_tracks)
         if dead_tracks_count > 0:
             msg = tr("Your iTunes Library contains %d dead tracks ready to be removed. Continue?")
             if self.view.ask_yes_no(msg % dead_tracks_count):
                 self.remove_dead_tracks()
         else:
             msg = tr("You have no dead tracks in your iTunes Library")
             self.view.show_message(msg)
     if jobid == JobType.Load:
         if hasattr(self, 'itunes_songs'):
             # If we load another file, we want a refresh song list
             del self.itunes_songs
     DupeGuruBase._job_completed(self, jobid)
Пример #9
0
 def copy_or_move(self, dupe, copy, destination, dest_type):
     if isinstance(dupe, ITunesSong):
         copy = True
     return DupeGuruBase.copy_or_move(self, dupe, copy, destination, dest_type)
Пример #10
0
 def _do_delete_dupe(self, dupe, *args):
     if isinstance(dupe, ITunesSong):
         dupe.remove_from_library()
     DupeGuruBase._do_delete_dupe(self, dupe, *args)
Пример #11
0
 def __init__(self, view):
     DupeGuruBase.__init__(self, view)
     # Use fileclasses set in DupeGuruBase.__init__()
     self.directories = Directories(fileclasses=self.directories.fileclasses)
     self.dead_tracks = []
Пример #12
0
 def copy_or_move(self, dupe, copy, destination, dest_type):
     if isinstance(dupe, ITunesSong):
         copy = True
     return DupeGuruBase.copy_or_move(self, dupe, copy, destination,
                                      dest_type)
Пример #13
0
 def _do_delete_dupe(self, dupe, *args):
     if isinstance(dupe, ITunesSong):
         dupe.remove_from_library()
     DupeGuruBase._do_delete_dupe(self, dupe, *args)
Пример #14
0
 def __init__(self, view, appdata):
     appdata = op.join(appdata, 'dupeGuru Music Edition')
     DupeGuruBase.__init__(self, view, appdata)
     # Use fileclasses set in DupeGuruBase.__init__()
     self.directories = Directories(fileclasses=self.directories.fileclasses)
     self.dead_tracks = []
Пример #15
0
 def __init__(self, view):
     DupeGuruBase.__init__(self, view)
     # Use fileclasses set in DupeGuruBase.__init__()
     self.directories = Directories(fileclasses=self.directories.fileclasses)
     self.dead_tracks = []