Service Manager loading - finished

This commit is contained in:
Tim Bentley 2010-09-30 21:21:45 +01:00
parent 68b38aa88c
commit 4d3a473e91
2 changed files with 19 additions and 23 deletions

View File

@ -811,11 +811,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':')
print message
for item in self.serviceItems: for item in self.serviceItems:
print item[u'service_item'].title, item[u'service_item']._uuid
if item[u'service_item']._uuid == uuid: if item[u'service_item']._uuid == uuid:
print u'match'
item[u'service_item'].editId = editId item[u'service_item'].editId = editId
def addServiceItem(self, item, rebuild=False, expand=True, replace=False): def addServiceItem(self, item, rebuild=False, expand=True, replace=False):

View File

@ -379,24 +379,23 @@ class SongMediaItem(MediaManagerItem):
""" """
Triggered by a song being loaded by the service item Triggered by a song being loaded by the service item
""" """
print item.data_string[u'title'].split(u'@')[0] if item.data_string:
search_results = self.parent.manager.get_all_objects(Song, search_results = self.parent.manager.get_all_objects(Song,
Song.search_title.like(u'%' + item.data_string[u'title'].split(u'@')[0] + u'%'), Song.search_title.like(u'%' + item.data_string[u'title'].split(u'@')[0] + u'%'),
Song.search_title.asc()) Song.search_title.asc())
print item.data_string[u'authors'].split(u',') author_list = item.data_string[u'authors'].split(u',')
author_list = item.data_string[u'authors'].split(u',') editId = 0
editId = 0 uuid = 0
uuid = 0 if search_results:
if search_results: for song in search_results:
for song in search_results: count = 0
count = 0 for author in song.authors:
for author in song.authors: if author.display_name in author_list:
if author.display_name in author_list: count += 1
count += 1 if count == len(author_list):
if count == len(author_list): editId = song.id
editId = song.id uuid = item._uuid
uuid = item._uuid if editId != 0:
if editId != 0: Receiver.send_message(u'service_item_update',
Receiver.send_message(u'service_item_update', u'%s:%s' %(editId, uuid))
u'%s:%s' %(editId, uuid))