← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~googol-hush/openlp/songs into lp:openlp

 

Andreas Preikschat has proposed merging lp:~googol-hush/openlp/songs into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~googol-hush/openlp/songs/+merge/54108

Hello

- convert translated verse orders (some time ago, it was possible to add translated verse orders to the database). When there is no verse with a verse tag in a verse order then the verse order is dropped.
-- 
https://code.launchpad.net/~googol-hush/openlp/songs/+merge/54108
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/songs into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2011-03-15 19:55:49 +0000
+++ openlp/core/lib/serviceitem.py	2011-03-19 16:17:26 +0000
@@ -183,8 +183,9 @@
         else:
             log.error(u'Invalid value renderer :%s' % self.service_item_type)
         self.title = clean_tags(self.title)
-        # The footer should never be None, but to be compatible with older
-        # release of OpenLP, we have to correct this to avoid tracebacks.
+        # The footer should never be None, but to be compatible with a few
+        # nightly builds between 1.9.4 and 1.9.5, we have to correct this to
+        # avoid tracebacks.
         if self.raw_footer is None:
             self.raw_footer = []
         self.foot_text = \
@@ -447,4 +448,5 @@
         elif not start and end:
             return end
         else:
-            return u'%s : %s' % (start, end)
\ No newline at end of file
+            return u'%s : %s' % (start, end)
+

=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2011-03-18 18:43:26 +0000
+++ openlp/plugins/songs/lib/__init__.py	2011-03-19 16:17:26 +0000
@@ -275,14 +275,33 @@
     sxml = SongXML()
     # Rebuild the song's verses, to remove any wrong verse names (for example
     # translated ones), which might have been added prior to 1.9.5.
+    # List for later comparison.
+    compare_order = []
     for verse in verses:
+        type = VerseType.Tags[VerseType.from_loose_input(verse[0][u'type'])]
         sxml.add_verse_to_lyrics(
-            VerseType.Tags[VerseType.from_loose_input(verse[0][u'type'])],
+            type,
             verse[0][u'label'],
             verse[1],
             verse[0][u'lang'] if verse[0].has_key(u'lang') else None
         )
+        compare_order.append((u'%s%s' % (type, verse[0][u'label'])).upper())
     song.lyrics = unicode(sxml.extract_xml(), u'utf-8')
+    # Rebuild the verse order, to convert translated verse tags, which might
+    # have been added prior to 1.9.5.
+    order = song.verse_order.strip().split()
+    new_order = []
+    for verse_def in order:
+        new_order.append((u'%s%s' % (
+            VerseType.Tags[VerseType.from_loose_input(verse_def[0])],
+            verse_def[1:])).upper()
+        )
+    song.verse_order = u' '.join(new_order)
+    # Check if the verse order contains tags for verses which do not exist.
+    for order in new_order:
+        if order not in compare_order:
+            song.verse_order = u''
+            break
     # The song does not have any author, add one.
     if not song.authors:
         name = SongStrings.AuthorUnknown

=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py	2011-03-16 17:21:03 +0000
+++ openlp/plugins/songs/lib/mediaitem.py	2011-03-19 16:17:26 +0000
@@ -461,5 +461,5 @@
         """
         Locale aware collation of song titles
         """
-        return locale.strcoll(unicode(song_1.title.lower()), 
+        return locale.strcoll(unicode(song_1.title.lower()),
              unicode(song_2.title.lower()))

=== modified file 'openlp/plugins/songs/lib/sofimport.py'
--- openlp/plugins/songs/lib/sofimport.py	2011-03-15 01:07:40 +0000
+++ openlp/plugins/songs/lib/sofimport.py	2011-03-19 16:17:26 +0000
@@ -309,7 +309,7 @@
         self.add_verse(lyrics, tag)
         if not self.is_chorus and u'C1' in self.verse_order_list_generated:
             self.verse_order_list_generated.append(u'C1')
-            self.verse_order_list_generated_useful = True                    
+            self.verse_order_list_generated_useful = True
 
     def uncap_text(self, text):
         """

=== modified file 'openlp/plugins/songs/lib/songimport.py'
--- openlp/plugins/songs/lib/songimport.py	2011-03-15 19:33:11 +0000
+++ openlp/plugins/songs/lib/songimport.py	2011-03-19 16:17:26 +0000
@@ -225,7 +225,7 @@
             self.verse_counts[verse_def[0]] = int(verse_def[1:])
         self.verses.append([verse_def, verse_text.rstrip(), lang])
         self.verse_order_list_generated.append(verse_def)
-        
+
     def repeat_verse(self):
         """
         Repeat the previous verse in the verse order

=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py	2011-03-16 17:50:37 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py	2011-03-19 16:17:26 +0000
@@ -131,7 +131,7 @@
                         lengthDescriptor, = struct.unpack("B", songData.read(1))
                     data = songData.read(lengthDescriptor)
                     if blockKey == TITLE:
-                        self.title =  unicode(data, u'cp1252')
+                        self.title = unicode(data, u'cp1252')
                     elif blockKey == AUTHOR:
                         authors = data.split(" / ")
                         for author in authors:


Follow ups