From 8a8ac027f50c39cfe127be43b3157721cc4aefc4 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 18 Aug 2013 11:23:20 -0400 Subject: [PATCH] Fixed ME's cocoa interface file, which was broken (again) The Remove Dead Tracks didn't use the new job system and appscript wasn't properly packaged. --- build.py | 2 +- cocoa/inter/app_me.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/build.py b/build.py index 335f2602..5ae90608 100644 --- a/build.py +++ b/build.py @@ -104,7 +104,7 @@ def build_cocoa(edition, dev): if not op.exists(pydep_folder): os.mkdir(pydep_folder) shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build') - appscript_pkgs = ['appscript', 'aem', 'mactypes'] + appscript_pkgs = ['appscript', 'aem', 'mactypes', 'osax'] specific_packages = { 'se': ['core_se'], 'me': ['core_me'] + appscript_pkgs + ['hsaudiotag'], diff --git a/cocoa/inter/app_me.py b/cocoa/inter/app_me.py index 002fcac1..f0010609 100644 --- a/cocoa/inter/app_me.py +++ b/cocoa/inter/app_me.py @@ -184,11 +184,14 @@ class DupeGuruME(DupeGuruBase): pass # We'll return the default file type, as per the last line of this method return DupeGuruBase._create_file(self, path) - 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 + 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: @@ -202,7 +205,7 @@ class DupeGuruME(DupeGuruBase): 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) + DupeGuruBase._job_completed(self, jobid) def copy_or_move(self, dupe, copy, destination, dest_type): if isinstance(dupe, ITunesSong): @@ -230,7 +233,7 @@ class DupeGuruME(DupeGuruBase): except CommandError as e: logging.warning('Error while trying to remove a track from iTunes: %s' % str(e)) - self.view.start_job(JobType.RemoveDeadTracks, do) + self._start_job(JobType.RemoveDeadTracks, do) def scan_dead_tracks(self): def do(j): @@ -248,7 +251,7 @@ class DupeGuruME(DupeGuruBase): self.dead_tracks.append(track) logging.info('Found %d dead tracks' % len(self.dead_tracks)) - self.view.start_job(JobType.ScanDeadTracks, do) + self._start_job(JobType.ScanDeadTracks, do) class PyDupeGuru(PyDupeGuruBase): def __init__(self):