Removed files still get processed during fingerprinting. (#2738)

This commit is contained in:
Lukáš Lalinský
2007-05-01 14:05:31 +02:00
parent f5be182296
commit 5dbb65ca08
4 changed files with 26 additions and 10 deletions

View File

@@ -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:

View File

@@ -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()

View File

@@ -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',

View File

@@ -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