forked from openlp/openlp
Fix song service load (Bug #696219)
This commit is contained in:
parent
d4e91ed553
commit
a120719884
@ -32,7 +32,7 @@ from PyQt4 import QtCore, QtGui
|
||||
from sqlalchemy.sql import or_
|
||||
|
||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
|
||||
ItemCapabilities, translate, check_item_selected
|
||||
ItemCapabilities, translate, check_item_selected, PluginStatus
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||
SongImportForm
|
||||
from openlp.plugins.songs.lib import OpenLyrics, SongXML
|
||||
@ -396,7 +396,8 @@ class SongMediaItem(MediaManagerItem):
|
||||
Triggered by a song being loaded by the service item
|
||||
"""
|
||||
log.debug(u'serviceLoad')
|
||||
if item.data_string:
|
||||
if self.plugin.status != PluginStatus.Active or not item.data_string:
|
||||
return
|
||||
search_results = self.parent.manager.get_all_objects(Song,
|
||||
Song.search_title == re.compile(r'\W+', re.UNICODE).sub(u' ',
|
||||
item.data_string[u'title'].split(u'@')[0].lower()).strip(),
|
||||
@ -412,10 +413,9 @@ class SongMediaItem(MediaManagerItem):
|
||||
if search_results:
|
||||
for song in search_results:
|
||||
same_authors = True
|
||||
# If the author counts are different, we do not have to do
|
||||
# any further checking. This is also important when a song
|
||||
# does not have any author (because we can not loop over an
|
||||
# empty list).
|
||||
# If the author counts are different, we do not have to do any
|
||||
# further checking. This is also important when a song does not
|
||||
# have any author (because we can not loop over an empty list).
|
||||
if len(song.authors) == len(author_list):
|
||||
for author in song.authors:
|
||||
if author.display_name not in author_list:
|
||||
|
Loading…
Reference in New Issue
Block a user