← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~phill-ridout/openlp/foil_fixes into lp:openlp

 

phill has proposed merging lp:~phill-ridout/openlp/foil_fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1015524 in OpenLP: "Foil importer crashes when missing certain tags"
  https://bugs.launchpad.net/openlp/+bug/1015524

For more details, see:
https://code.launchpad.net/~phill-ridout/openlp/foil_fixes/+merge/115000
-- 
https://code.launchpad.net/~phill-ridout/openlp/foil_fixes/+merge/115000
Your team OpenLP Core is requested to review the proposed merge of lp:~phill-ridout/openlp/foil_fixes into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/foilpresenterimport.py'
--- openlp/plugins/songs/lib/foilpresenterimport.py	2012-06-22 14:14:53 +0000
+++ openlp/plugins/songs/lib/foilpresenterimport.py	2012-07-14 21:24:18 +0000
@@ -483,8 +483,9 @@
         # Process verse order
         verse_order = []
         verse_strophenr = []
-        for strophennummer in foilpresenterfolie.reihenfolge.strophennummer:
-            verse_strophenr.append(strophennummer)
+        if hasattr(foilpresenterfolie, u'reihenfolge.strophennummer'):
+            for strophennummer in foilpresenterfolie.reihenfolge.strophennummer:
+                verse_strophenr.append(strophennummer)
         # Currently we do not support different "parts"!
         if u'0' in temp_verse_order:
             for vers in temp_verse_order_backup:
@@ -538,12 +539,18 @@
         ``song``
             The song object.
         """
-        for title_string in foilpresenterfolie.titel.titelstring:
-            if not song.title:
-                song.title = self._child(title_string)
-                song.alternate_title = u''
-            else:
-                song.alternate_title = self._child(title_string)
+        if hasattr(foilpresenterfolie, u'titel.titelstring'):
+            for title_string in foilpresenterfolie.titel.titelstring:
+                if not song.title:
+                    song.title = self._child(title_string)
+                    song.alternate_title = u''
+                else:
+                    song.alternate_title = self._child(title_string)
+        else:
+            # Use first line of first verse
+            #if hasattr(foilpresenterfolie, u'strophen.strophe'):
+            first_line = self._child(foilpresenterfolie.strophen.strophe.text_)
+            song.title = first_line.split('\n')[0]
 
     def _process_topics(self, foilpresenterfolie, song):
         """


Follow ups