This commit is contained in:
Tim Bentley 2013-01-21 07:34:50 +00:00
parent b04a6bba79
commit 4224d8befe
6 changed files with 24 additions and 24 deletions

View File

@ -161,7 +161,7 @@ class ServiceItem(object):
self.service_item_type = None self.service_item_type = None
self._raw_frames = [] self._raw_frames = []
self._display_frames = [] self._display_frames = []
self.unique_identifyer = 0 self.unique_identifier = 0
self.notes = u'' self.notes = u''
self.from_plugin = False self.from_plugin = False
self.capabilities = [] self.capabilities = []
@ -195,7 +195,7 @@ class ServiceItem(object):
Method to set the internal id of the item. This is used to compare Method to set the internal id of the item. This is used to compare
service items to see if they are the same. service items to see if they are the same.
""" """
self.unique_identifyer = unicode(uuid.uuid1()) self.unique_identifier = unicode(uuid.uuid1())
self.validate_item() self.validate_item()
def add_capability(self, capability): def add_capability(self, capability):
@ -454,14 +454,14 @@ class ServiceItem(object):
def merge(self, other): def merge(self, other):
""" """
Updates the unique_identifyer with the value from the original one Updates the unique_identifier with the value from the original one
The unique_identifyer is unique for a given service item but this allows one to The unique_identifier is unique for a given service item but this allows one to
replace an original version. replace an original version.
``other`` ``other``
The service item to be merged with The service item to be merged with
""" """
self.unique_identifyer = other.unique_identifyer self.unique_identifier = other.unique_identifier
self.notes = other.notes self.notes = other.notes
self.temporary_edit = other.temporary_edit self.temporary_edit = other.temporary_edit
# Copy theme over if present. # Copy theme over if present.
@ -478,13 +478,13 @@ class ServiceItem(object):
""" """
if not other: if not other:
return False return False
return self.unique_identifyer == other.unique_identifyer return self.unique_identifier == other.unique_identifier
def __ne__(self, other): def __ne__(self, other):
""" """
Confirms the service items are not for the same instance Confirms the service items are not for the same instance
""" """
return self.unique_identifyer != other.unique_identifyer return self.unique_identifier != other.unique_identifier
def is_media(self): def is_media(self):
""" """

View File

@ -480,7 +480,7 @@ class ServiceManager(QtGui.QWidget):
for i, filename in enumerate( for i, filename in enumerate(
service_item[u'header'][u'background_audio']): service_item[u'header'][u'background_audio']):
new_file_item= os.path.join(u'audio', new_file_item= os.path.join(u'audio',
item[u'service_item'].unique_identifyer, filename) item[u'service_item'].unique_identifier, filename)
audio_files.append((filename, new_file)) audio_files.append((filename, new_file))
service_item[u'header'][u'background_audio'][i] = new_file service_item[u'header'][u'background_audio'][i] = new_file
# Add the service item to the service. # Add the service item to the service.
@ -489,7 +489,7 @@ class ServiceManager(QtGui.QWidget):
for file_item in write_list: for file_item in write_list:
file_size = os.path.getsize(file_item) file_size = os.path.getsize(file_item)
total_size += file_size total_size += file_size
log.debug(u'ServiceManager.savefile_item - ZIP contents size is %i bytes' % total_size) log.debug(u'ServiceManager.savefile - ZIP contents size is %i bytes' % total_size)
service_content = cPickle.dumps(service) service_content = cPickle.dumps(service)
# Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be # Usual Zip file cannot exceed 2GiB, file with Zip64 cannot be
# extracted using unzip in UNIX. # extracted using unzip in UNIX.
@ -708,11 +708,11 @@ class ServiceManager(QtGui.QWidget):
else: else:
serviceItem.set_from_service(item, self.servicePath) serviceItem.set_from_service(item, self.servicePath)
serviceItem.validate_item(self.suffixes) serviceItem.validate_item(self.suffixes)
self.load_item_unique_identifyer = 0 self.load_item_unique_identifier = 0
if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate): if serviceItem.is_capable(ItemCapabilities.OnLoadUpdate):
Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem) Receiver.send_message(u'%s_service_load' % serviceItem.name.lower(), serviceItem)
# if the item has been processed # if the item has been processed
if serviceItem.unique_identifyer == self.load_item_unique_identifyer: if serviceItem.unique_identifier == self.load_item_unique_identifier:
serviceItem.edit_id = int(self.load_item_edit_id) serviceItem.edit_id = int(self.load_item_edit_id)
serviceItem.temporary_edit = self.load_item_temporary serviceItem.temporary_edit = self.load_item_temporary
self.addServiceItem(serviceItem, repaint=False) self.addServiceItem(serviceItem, repaint=False)
@ -918,9 +918,9 @@ class ServiceManager(QtGui.QWidget):
Called by the SlideController to request a preview item be made live Called by the SlideController to request a preview item be made live
and allows the next preview to be updated if relevant. and allows the next preview to be updated if relevant.
""" """
unique_identifyer, row = message.split(u':') unique_identifier, row = message.split(u':')
for sitem in self.serviceItems: for sitem in self.serviceItems:
if sitem[u'service_item'].unique_identifyer == unique_identifyer: if sitem[u'service_item'].unique_identifier == unique_identifier:
item = self.serviceManagerList.topLevelItem(sitem[u'order'] - 1) item = self.serviceManagerList.topLevelItem(sitem[u'order'] - 1)
self.serviceManagerList.setCurrentItem(item) self.serviceManagerList.setCurrentItem(item)
self.makeLive(int(row)) self.makeLive(int(row))
@ -1254,7 +1254,7 @@ class ServiceManager(QtGui.QWidget):
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 Save the values as they will be used as part of the service load
""" """
edit_id, self.load_item_unique_identifyer, temporary = message.split(u':') edit_id, self.load_item_unique_identifier, temporary = message.split(u':')
self.load_item_edit_id = int(edit_id) self.load_item_edit_id = int(edit_id)
self.load_item_temporary = str_to_bool(temporary) self.load_item_temporary = str_to_bool(temporary)

View File

@ -1219,7 +1219,7 @@ class SlideController(DisplayController):
if -1 < row < self.previewListWidget.rowCount(): if -1 < row < self.previewListWidget.rowCount():
if self.serviceItem.from_service: if self.serviceItem.from_service:
Receiver.send_message('servicemanager_preview_live', u'%s:%s' % Receiver.send_message('servicemanager_preview_live', u'%s:%s' %
(self.serviceItem.unique_identifyer, row)) (self.serviceItem.unique_identifier, row))
else: else:
self.parent().liveController.addServiceManagerItem(self.serviceItem, row) self.parent().liveController.addServiceManagerItem(self.serviceItem, row)

View File

@ -258,7 +258,7 @@ class CustomMediaItem(MediaManagerItem):
and_(CustomSlide.title == item.title, CustomSlide.theme_name == item.theme, and_(CustomSlide.title == item.title, CustomSlide.theme_name == item.theme,
CustomSlide.credits == item.raw_footer[0][len(item.title) + 1:])) CustomSlide.credits == item.raw_footer[0][len(item.title) + 1:]))
if custom: if custom:
Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifyer, False)) Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
else: else:
if self.add_custom_from_service: if self.add_custom_from_service:
self.create_from_service_item(item) self.create_from_service_item(item)
@ -288,7 +288,7 @@ class CustomMediaItem(MediaManagerItem):
self.plugin.manager.save_object(custom) self.plugin.manager.save_object(custom)
self.onSearchTextButtonClicked() self.onSearchTextButtonClicked()
if item.name.lower() == u'custom': if item.name.lower() == u'custom':
Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifyer, False)) Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
def onClearTextButtonClick(self): def onClearTextButtonClick(self):
""" """

View File

@ -252,17 +252,17 @@ class HttpConnection(object):
service_items = [] service_items = []
service_manager = self.parent.plugin.serviceManager service_manager = self.parent.plugin.serviceManager
if self.parent.current_item: if self.parent.current_item:
current_unique_identifyer = self.parent.current_item.unique_identifyer current_unique_identifier = self.parent.current_item.unique_identifier
else: else:
current_unique_identifyer = None current_unique_identifier = None
for item in service_manager.serviceItems: for item in service_manager.serviceItems:
service_item = item[u'service_item'] service_item = item[u'service_item']
service_items.append({ service_items.append({
u'id': unicode(service_item.unique_identifyer), u'id': unicode(service_item.unique_identifier),
u'title': unicode(service_item.get_display_title()), u'title': unicode(service_item.get_display_title()),
u'plugin': unicode(service_item.name), u'plugin': unicode(service_item.name),
u'notes': unicode(service_item.notes), u'notes': unicode(service_item.notes),
u'selected': (service_item.unique_identifyer == current_unique_identifyer) u'selected': (service_item.unique_identifier == current_unique_identifier)
}) })
return service_items return service_items
@ -388,7 +388,7 @@ class HttpConnection(object):
result = { result = {
u'service': self.parent.plugin.serviceManager.service_id, u'service': self.parent.plugin.serviceManager.service_id,
u'slide': self.parent.current_slide or 0, u'slide': self.parent.current_slide or 0,
u'item': self.parent.current_item.unique_identifyer if self.parent.current_item else u'', u'item': self.parent.current_item.unique_identifier if self.parent.current_item else u'',
u'twelve':Settings().value(u'remotes/twelve hour', True), u'twelve':Settings().value(u'remotes/twelve hour', True),
u'blank': self.parent.plugin.liveController.blankScreen.isChecked(), u'blank': self.parent.plugin.liveController.blankScreen.isChecked(),
u'theme': self.parent.plugin.liveController.themeScreen.isChecked(), u'theme': self.parent.plugin.liveController.themeScreen.isChecked(),
@ -459,7 +459,7 @@ class HttpConnection(object):
data.append(item) data.append(item)
json_data = {u'results': {u'slides': data}} json_data = {u'results': {u'slides': data}}
if current_item: if current_item:
json_data[u'results'][u'item'] = self.parent.current_item.unique_identifyer json_data[u'results'][u'item'] = self.parent.current_item.unique_identifier
else: else:
if self.url_params and self.url_params.get(u'data'): if self.url_params and self.url_params.get(u'data'):
try: try:

View File

@ -539,7 +539,7 @@ class SongMediaItem(MediaManagerItem):
temporary = True temporary = True
# Update service with correct song id. # Update service with correct song id.
if editId: if editId:
Receiver.send_message(u'service_item_update%s:%s:%s' % (editId, item.unique_identifyer, temporary)) Receiver.send_message(u'service_item_update%s:%s:%s' % (editId, item.unique_identifier, temporary))
def search(self, string, showError): def search(self, string, showError):
""" """