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.
"""
editId, uuid = message.split(u':')
print message
for item in self.serviceItems:
print item[u'service_item'].title, item[u'service_item']._uuid
if item[u'service_item']._uuid == uuid:
print u'match'
item[u'service_item'].editId = editId
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
"""
print item.data_string[u'title'].split(u'@')[0]
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.asc())
print item.data_string[u'authors'].split(u',')
author_list = item.data_string[u'authors'].split(u',')
editId = 0
uuid = 0
if search_results:
for song in search_results:
count = 0
for author in song.authors:
if author.display_name in author_list:
count += 1
if count == len(author_list):
editId = song.id
uuid = item._uuid
if editId != 0:
Receiver.send_message(u'service_item_update',
u'%s:%s' %(editId, uuid))
if item.data_string:
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.asc())
author_list = item.data_string[u'authors'].split(u',')
editId = 0
uuid = 0
if search_results:
for song in search_results:
count = 0
for author in song.authors:
if author.display_name in author_list:
count += 1
if count == len(author_list):
editId = song.id
uuid = item._uuid
if editId != 0:
Receiver.send_message(u'service_item_update',
u'%s:%s' %(editId, uuid))