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: if item:
self.autoSelectId = item.data(QtCore.Qt.UserRole).toInt()[0] 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`` 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
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). Search for some Bible verses (by reference).
""" """
bible = unicode(self.quickVersionComboBox.currentText()) 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: if search_results:
versetext = u' '.join([verse.text for verse in search_results]) versetext = u' '.join([verse.text for verse in search_results])
return [[string, versetext]] return [[string, versetext]]

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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