Correct problem it tags not being used on song load

This commit is contained in:
Tim Bentley 2011-09-25 07:37:40 +01:00
commit 88c09d8981
3 changed files with 9 additions and 4 deletions

View File

@ -87,6 +87,7 @@ class ServiceItem(object):
if plugin: if plugin:
self.renderer = plugin.renderer self.renderer = plugin.renderer
self.name = plugin.name self.name = plugin.name
self.from_service = False if plugin else False
self.title = u'' self.title = u''
self.shortname = u'' self.shortname = u''
self.audit = u'' self.audit = u''
@ -115,7 +116,6 @@ class ServiceItem(object):
self.start_time = 0 self.start_time = 0
self.end_time = 0 self.end_time = 0
self.media_length = 0 self.media_length = 0
self.from_service = False
self.image_border = u'#000000' self.image_border = u'#000000'
self.background_audio = [] self.background_audio = []
self._new_item() self._new_item()

View File

@ -660,14 +660,16 @@ 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)
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)
@ -1124,6 +1126,8 @@ class ServiceManager(QtGui.QWidget):
Triggered from plugins to update service items. Triggered from plugins to update service items.
""" """
editId, uuid = message.split(u':') editId, uuid = message.split(u':')
self.loadItem_uuid = uuid
self.loadItem_editId = editId
for item in self.serviceItems: for item in self.serviceItems:
if item[u'service_item']._uuid == uuid: if item[u'service_item']._uuid == uuid:
item[u'service_item'].edit_id = int(editId) item[u'service_item'].edit_id = int(editId)

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