Head r1906

This commit is contained in:
Jon Tibble 2012-03-16 22:56:06 +00:00
commit 5ded814527
9 changed files with 27 additions and 15 deletions

View File

@ -641,7 +641,7 @@ class MediaManagerItem(QtGui.QWidget):
if item:
self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0]
def search(self, string):
def search(self, string, showError=True):
"""
Performs a plugin specific search for items containing ``string``
"""

View File

@ -1025,12 +1025,13 @@ class BibleMediaItem(MediaManagerItem):
return u'{su}[%s]{/su}' % verse_text
return u'{su}%s{/su}' % verse_text
def search(self, string):
def search(self, string, showError):
"""
Search for some Bible verses (by reference).
"""
bible = unicode(self.quickVersionComboBox.currentText())
search_results = self.plugin.manager.get_verses(bible, string, False)
search_results = self.plugin.manager.get_verses(bible, string, False,
showError)
if search_results:
versetext = u' '.join([verse.text for verse in search_results])
return [[string, versetext]]

View File

@ -267,7 +267,7 @@ class CustomMediaItem(MediaManagerItem):
self.searchTextEdit.clear()
self.onSearchTextButtonClick()
def search(self, string):
def search(self, string, showError):
search_results = self.manager.get_all_objects(CustomSlide,
or_(func.lower(CustomSlide.title).like(u'%' +
string.lower() + u'%'),

View File

@ -234,7 +234,7 @@ class ImageMediaItem(MediaManagerItem):
'There was a problem replacing your background, '
'the image file "%s" no longer exists.')) % filename)
def search(self, string):
def search(self, string, showError):
files = SettingsManager.load_list(self.settingsSection, u'images')
results = []
string = string.lower()

View File

@ -310,7 +310,7 @@ class MediaMediaItem(MediaManagerItem):
media = filter(lambda x: os.path.splitext(x)[1] in ext, media)
return media
def search(self, string):
def search(self, string, showError):
files = SettingsManager.load_list(self.settingsSection, u'media')
results = []
string = string.lower()

View File

@ -322,7 +322,7 @@ class PresentationMediaItem(MediaManagerItem):
return controller
return None
def search(self, string):
def search(self, string, showError):
files = SettingsManager.load_list(
self.settingsSection, u'presentations')
results = []

View File

@ -522,7 +522,7 @@ class HttpConnection(object):
plugin = self.parent.plugin.pluginManager.get_plugin_by_name(type)
if plugin.status == PluginStatus.Active and \
plugin.mediaItem and plugin.mediaItem.hasSearch:
results = plugin.mediaItem.search(text)
results = plugin.mediaItem.search(text, False)
else:
results = []
return HttpResponse(

View File

@ -159,6 +159,12 @@ class CCLIFileImport(SongImport):
song_author = u''
song_topics = u''
for line in textList:
if line.startswith(u'[S '):
ccli, line = line.split(u']', 1)
if ccli.startswith(u'[S A'):
self.ccliNumber = ccli[4:].strip()
else:
self.ccliNumber = ccli[3:].strip()
if line.startswith(u'Title='):
self.title = line[6:].strip()
elif line.startswith(u'Author='):
@ -166,9 +172,7 @@ class CCLIFileImport(SongImport):
elif line.startswith(u'Copyright='):
self.copyright = line[10:].strip()
elif line.startswith(u'Themes='):
song_topics = line[7:].strip()
elif line.startswith(u'[S A'):
self.ccliNumber = line[4:-3].strip()
song_topics = line[7:].strip().replace(u' | ', u'/t')
elif line.startswith(u'Fields='):
# Fields contain single line indicating verse, chorus, etc,
# /t delimited, same as with words field. store seperately
@ -193,6 +197,7 @@ class CCLIFileImport(SongImport):
check_first_verse_line = True
verse_text = unicode(words_list[counter])
verse_text = verse_text.replace(u'/n', u'\n')
verse_text = verse_text.replace(u' | ', u'\n')
verse_lines = verse_text.split(u'\n', 1)
if check_first_verse_line:
if verse_lines[0].startswith(u'(PRE-CHORUS'):
@ -243,7 +248,7 @@ class CCLIFileImport(SongImport):
<Empty line>
Song CCLI number
# e.g. CCLI Number (e.g.CCLI-Liednummer: 2672885)
Song copyright
Song copyright (if it begins ©, otherwise after authors)
# e.g. © 1999 Integrity's Hosanna! Music | LenSongs Publishing
Song authors # e.g. Lenny LeBlanc | Paul Baloche
Licencing info
@ -322,11 +327,17 @@ class CCLIFileImport(SongImport):
#line_number=2, copyright
if line_number == 2:
line_number += 1
self.copyright = clean_line
if clean_line.startswith(u'©'):
self.copyright = clean_line
else:
song_author = clean_line
#n=3, authors
elif line_number == 3:
line_number += 1
song_author = clean_line
if song_author:
self.copyright = clean_line
else:
song_author = clean_line
#line_number=4, comments lines before last line
elif line_number == 4 and not clean_line.startswith(u'CCL'):
self.comments += clean_line

View File

@ -586,7 +586,7 @@ class SongMediaItem(MediaManagerItem):
Receiver.send_message(u'service_item_update',
u'%s:%s:%s' % (editId, item._uuid, temporary))
def search(self, string):
def search(self, string, showError):
"""
Search for some songs
"""