← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/song-order into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/song-order into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  #598805 Song order in media manager inconsistency
  https://bugs.launchpad.net/bugs/598805


Fixed bug #598805 - Song order inconsistency.
-- 
https://code.launchpad.net/~raoul-snyman/openlp/song-order/+merge/36600
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/song-order into lp:openlp.
=== modified file 'openlp/plugins/songs/forms/editsongform.py'
--- openlp/plugins/songs/forms/editsongform.py	2010-09-17 19:02:25 +0000
+++ openlp/plugins/songs/forms/editsongform.py	2010-09-24 20:59:40 +0000
@@ -629,7 +629,7 @@
         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 @@
                     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 @@
     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()

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2010-09-04 17:39:03 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2010-09-24 20:59:40 +0000
@@ -166,13 +166,13 @@
         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:

=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py	2010-09-15 20:12:03 +0000
+++ openlp/plugins/songs/lib/songimport.py	2010-09-24 20:59:40 +0000
@@ -55,6 +55,7 @@
         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 @@
         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 @@
                 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):

=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py	2010-09-21 17:30:32 +0000
+++ openlp/plugins/songs/songsplugin.py	2010-09-24 20:59:40 +0000
@@ -63,7 +63,7 @@
         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):
         """


Follow ups