diff --git a/NEWS.txt b/NEWS.txt index 0936101c8..65056edef 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -16,6 +16,7 @@ Version 0.9.0beta1 - 2007-XX-YY * Remove video files from the list of supported formats. * Always use musicbrainz.org for PUID submissions. (#2764) * Files/Pending Files count not reset/recalculated after removing files. (#2541) + * Removed files still get processed during fingerprinting. (#2738) Version 0.9.0alpha8 - 2007-04-15 * New Features: diff --git a/picard/file.py b/picard/file.py index 0e220ad1d..f453554a0 100644 --- a/picard/file.py +++ b/picard/file.py @@ -91,6 +91,8 @@ class File(LockableObject, Item): spawn(self._load_thread, finished) def _load_thread(self, finished): + if self.state != File.PENDING: + return self.log.debug("Loading file %r", self) error = None try: @@ -101,6 +103,8 @@ class File(LockableObject, Item): proxy_to_main(self._load_thread_finished, finished, error) def _load_thread_finished(self, finished, error): + if self.state != File.PENDING: + return self.error = error self.state = (self.error is None) and File.NORMAL or File.ERROR self._post_load() @@ -432,10 +436,14 @@ class File(LockableObject, Item): limit=7) def set_pending(self): + if self.state == File.REMOVED: + return self.state = File.PENDING self.update() def clear_pending(self): + if self.state == File.REMOVED: + return self.state = File.NORMAL self.update() diff --git a/picard/musicdns/__init__.py b/picard/musicdns/__init__.py index 0f06c6c20..ef05cad94 100644 --- a/picard/musicdns/__init__.py +++ b/picard/musicdns/__init__.py @@ -84,6 +84,9 @@ class OFA(QtCore.QObject): handler(file, puid) def _lookup_fingerprint(self, file, fingerprint, handler, length=0): + if file.state != file.PENDING: + handler(file, None) + return self.tagger.window.set_statusbar_message(N_("Looking up the fingerprint for file %s..."), file.filename) self.tagger.xmlws.query_musicdns(partial(self._lookup_finished, handler, file), rmt='0', diff --git a/picard/tagger.py b/picard/tagger.py index e8eae54e2..673016f6e 100644 --- a/picard/tagger.py +++ b/picard/tagger.py @@ -548,21 +548,25 @@ class Tagger(QtGui.QApplication): # ======================================================================= def _lookup_puid(self, file, puid): - if puid: - self.puidmanager.add(puid, None) - file.metadata['musicip_puid'] = puid - file.lookup_puid(puid) - else: - self.window.set_statusbar_message(N_("Couldn't find PUID for file %s"), file.filename) - file.clear_pending() + self._analyze_queue.remove(file) + if file.state == File.PENDING: + if puid: + self.puidmanager.add(puid, None) + file.metadata['musicip_puid'] = puid + file.lookup_puid(puid) + else: + self.window.set_statusbar_message(N_("Couldn't find PUID for file %s"), file.filename) + file.clear_pending() self._analyze_from_queue() def _analyze_from_queue(self): while self._analyze_queue: - file = self._analyze_queue.pop() - if file.state == File.PENDING: + file = self._analyze_queue[0] + if file.state != File.PENDING: + self._analyze_queue.pop(0) + else: self._ofa.analyze(file, self._lookup_puid) - break + return def analyze(self, objs): analyzing = len(self._analyze_queue) > 0