Fix edit for tags loaded for song which is not saved

bzr-revno: 1765
This commit is contained in:
Tim Bentley 2011-09-27 18:23:21 +01:00
commit 276d4045e3
2 changed files with 10 additions and 8 deletions

View File

@ -660,14 +660,17 @@ class ServiceManager(QtGui.QWidget):
for item in items: for item in items:
self.mainwindow.incrementProgressBar() self.mainwindow.incrementProgressBar()
serviceItem = ServiceItem() serviceItem = ServiceItem()
serviceItem.from_service = True
serviceItem.renderer = self.mainwindow.renderer serviceItem.renderer = self.mainwindow.renderer
serviceItem.set_from_service(item, self.servicePath) serviceItem.set_from_service(item, self.servicePath)
self.validateItem(serviceItem) self.validateItem(serviceItem)
self.addServiceItem(serviceItem, repaint=False) self.loadItem_uuid = 0
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' % Receiver.send_message(u'%s_service_load' %
serviceItem.name.lower(), serviceItem) serviceItem.name.lower(), serviceItem)
# if the item has been processed
if serviceItem._uuid == self.loadItem_uuid:
serviceItem.edit_id = int(self.loadItem_editId)
self.addServiceItem(serviceItem, repaint=False)
delete_file(p_file) delete_file(p_file)
self.setFileName(fileName) self.setFileName(fileName)
self.mainwindow.addRecentFile(fileName) self.mainwindow.addRecentFile(fileName)
@ -1122,12 +1125,10 @@ class ServiceManager(QtGui.QWidget):
def serviceItemUpdate(self, message): def serviceItemUpdate(self, message):
""" """
Triggered from plugins to update service items. Triggered from plugins to update service items.
Save the values as they will be used as part of the service load
""" """
editId, uuid = message.split(u':') editId, self.loadItem_uuid = message.split(u':')
for item in self.serviceItems: self.loadItem_editId = int(editId)
if item[u'service_item']._uuid == uuid:
item[u'service_item'].edit_id = int(editId)
self.setModified()
def replaceServiceItem(self, newItem): def replaceServiceItem(self, newItem):
""" """

View File

@ -510,7 +510,8 @@ class SongMediaItem(MediaManagerItem):
# Add the audio file to the service item. # Add the audio file to the service item.
if len(song.media_files) > 0: if len(song.media_files) > 0:
service_item.add_capability(ItemCapabilities.HasBackgroundAudio) service_item.add_capability(ItemCapabilities.HasBackgroundAudio)
service_item.background_audio = [m.file_name for m in song.media_files] service_item.background_audio = \
[m.file_name for m in song.media_files]
return True return True
def serviceLoad(self, item): def serviceLoad(self, item):