Fixed bug #598805 - Song order inconsistency.

bzr-revno: 1057
This commit is contained in:
Raoul Snyman 2010-09-25 08:48:40 +02:00
commit 648a69ba7d
4 changed files with 10 additions and 8 deletions

View File

@ -629,7 +629,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song.alternate_title = unicode(self.AlternativeEdit.text())
self.song.copyright = unicode(self.CopyrightEditItem.text())
self.song.search_title = self.song.title + u'@' + \
unicode(self.AlternativeEdit.text())
self.song.alternate_title
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text())
@ -669,7 +669,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
unicode(self.VerseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0])
self.song.search_lyrics = text
self.song.search_lyrics = text.lower()
self.song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
for verse in multiple:
self.song.verse_order = re.sub(u'([' + verse.upper() +
@ -682,4 +682,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def processTitle(self):
log.debug(u'processTitle')
self.song.search_title = re.sub(r'[\'"`,;:(){}?]+', u'',
unicode(self.song.search_title))
unicode(self.song.search_title)).lower()

View File

@ -166,13 +166,13 @@ class SongMediaItem(MediaManagerItem):
if search_type == 0:
log.debug(u'Titles Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.search_title.like(u'%' + search_keywords + u'%'),
Song.search_title.like(u'%' + search_keywords.lower() + u'%'),
Song.search_title.asc())
self.displayResultsSong(search_results)
elif search_type == 1:
log.debug(u'Lyrics Search')
search_results = self.parent.manager.get_all_objects(Song,
Song.search_lyrics.like(u'%' + search_keywords + u'%'),
Song.search_lyrics.like(u'%' + search_keywords.lower() + u'%'),
Song.search_lyrics.asc())
self.displayResultsSong(search_results)
elif search_type == 2:

View File

@ -55,6 +55,7 @@ class SongImport(QtCore.QObject):
self.set_defaults()
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_stop_import'), self.stop_import)
def set_defaults(self):
"""
Create defaults for properties - call this before each song
@ -262,8 +263,8 @@ class SongImport(QtCore.QObject):
log.info(u'commiting song %s to database', self.title)
song = Song()
song.title = self.title
song.search_title = self.remove_punctuation(self.title) \
+ '@' + self.alternate_title
song.search_title = self.remove_punctuation(self.title).lower() \
+ '@' + self.remove_punctuation(self.alternate_title).lower()
song.song_number = self.song_number
song.search_lyrics = u''
verses_changed_to_other = {}
@ -291,6 +292,7 @@ class SongImport(QtCore.QObject):
versetag = newversetag
sxml.add_verse_to_lyrics(versetype, versetag[1:], versetext)
song.search_lyrics += u' ' + self.remove_punctuation(versetext)
song.search_lyrics = song.search_lyrics.lower()
song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
for i, current_verse_tag in enumerate(self.verse_order_list):
if verses_changed_to_other.has_key(current_verse_tag):

View File

@ -63,7 +63,7 @@ class SongsPlugin(Plugin):
log.info(u'Songs Initialising')
Plugin.initialise(self)
self.mediaItem.displayResultsSong(
self.manager.get_all_objects(Song, order_by_ref=Song.title))
self.manager.get_all_objects(Song, order_by_ref=Song.search_title))
def getMediaManagerItem(self):
"""