From 9da35664bbc680768c083d3637131b108c733599 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 2 Aug 2010 20:05:40 +0100 Subject: [PATCH] Fix up songusage --- openlp/core/lib/serviceitem.py | 9 +-------- openlp/core/ui/slidecontroller.py | 2 -- openlp/plugins/songs/lib/mediaitem.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 5 +++-- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 1758d7836..ca7111d41 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -35,7 +35,7 @@ import uuid from PyQt4 import QtGui -from openlp.core.lib import build_icon, resize_image, Receiver +from openlp.core.lib import build_icon, resize_image log = logging.getLogger(__name__) @@ -390,10 +390,3 @@ class ServiceItem(object): Clear's the service item's cache. """ self.cache = {} - - def trigger_song_usage(self): - """ - Send the audit data if it exists - """ - if self.audit: - Receiver.send_message(u'songs_live_started', self.audit) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index dfb53cd9b..e118036d2 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -602,8 +602,6 @@ class SlideController(QtGui.QWidget): self.enableToolBar(serviceItem) self.onSlideSelected() self.PreviewListWidget.setFocus() - if self.isLive: - self.serviceItem.trigger_song_usage() Receiver.send_message(u'slidecontroller_%s_started' % self.typePrefix, [serviceItem]) if self.serviceItem.is_text(): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index ced7f584e..48983366f 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -370,6 +370,6 @@ class SongMediaItem(MediaManagerItem): translate('SongsPlugin.MediaItem', 'CCLI Licence: ') + ccli)) service_item.raw_footer = raw_footer service_item.audit = [ - song.title, author_audit, song.copyright, song.ccli_number + song.title, author_audit, song.copyright, unicode(ccli) ] return True diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 59f5907d1..c8dfd06fc 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -109,7 +109,7 @@ class SongUsagePlugin(Plugin): log.info(u'SongUsage Initialising') Plugin.initialise(self) QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'songs_live_started'), + QtCore.SIGNAL(u'slidecontroller_live_started'), self.onReceiveSongUsage) self.SongUsageActive = QtCore.QSettings().value( self.settingsSection + u'/active', @@ -133,10 +133,11 @@ class SongUsagePlugin(Plugin): QtCore.QSettings().setValue(self.settingsSection + u'/active', QtCore.QVariant(self.SongUsageActive)) - def onReceiveSongUsage(self, audit): + def onReceiveSongUsage(self, item): """ Song Usage for live song from SlideController """ + audit = item[0].audit if self.SongUsageActive and audit: song_usage_item = SongUsageItem() song_usage_item.usagedate = datetime.today()