mirror of
https://github.com/fergalmoran/picard.git
synced 2026-02-21 07:04:02 +00:00
Remove PUIDs from PUID manager when the corresponding file gets removed. This fixes a case where the PUID submission was activated again after removing a saved file.
This commit is contained in:
@@ -317,7 +317,7 @@ class File(LockableObject, Item):
|
||||
if from_parent and self.parent:
|
||||
self.log.debug("Removing %r from %r", self, self.parent)
|
||||
self.parent.remove_file(self)
|
||||
self.tagger.puidmanager.update(self.metadata['musicip_puid'], self.metadata['musicbrainz_trackid'])
|
||||
self.tagger.puidmanager.remove(self.metadata['musicip_puid'])
|
||||
self.state = File.REMOVED
|
||||
|
||||
def move(self, parent):
|
||||
|
||||
@@ -39,6 +39,10 @@ class PUIDManager(QtCore.QObject):
|
||||
self.__puids[puid] = (self.__puids.get(puid, (None, None))[0], trackid)
|
||||
self.__check_unsubmitted()
|
||||
|
||||
def remove(self, puid):
|
||||
try: del self.__puids[puid]
|
||||
except KeyError: pass
|
||||
|
||||
def __unsubmitted(self):
|
||||
"""Return the count of unsubmitted PUIDs."""
|
||||
for puid, (origtrackid, trackid) in self.__puids.iteritems():
|
||||
@@ -66,7 +70,7 @@ class PUIDManager(QtCore.QObject):
|
||||
self.tagger.window.set_statusbar_message(N_('PUIDs successfully submitted!'), timeout=3000)
|
||||
for puid in puids.values():
|
||||
try:
|
||||
self.__puids[puid] = (self.__puids[puid][0], self.__puids[puid][0])
|
||||
self.__puids[puid] = (self.__puids[puid][1], self.__puids[puid][1])
|
||||
except KeyError:
|
||||
pass
|
||||
self.__check_unsubmitted()
|
||||
|
||||
Reference in New Issue
Block a user