From 1478636c97700ab8183247207537c827de59a0e9 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Wed, 14 Aug 2013 21:22:17 +0100 Subject: [PATCH 1/2] Fixes #1211913. The case can change of field names, so have taken that in to account by converting them to upper case --- openlp/plugins/songs/lib/sundayplusimport.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/sundayplusimport.py index 9af6099e0..cd72cc564 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/sundayplusimport.py @@ -96,7 +96,7 @@ class SundayPlusImport(SongImport): # Now we are looking for the name. if data[i:i + 1] == '#': name_end = data.find(':', i + 1) - name = data[i + 1:name_end] + name = data[i + 1:name_end].upper() i = name_end + 1 while data[i:i + 1] == ' ': i += 1 @@ -122,13 +122,13 @@ class SundayPlusImport(SongImport): value = data[i:end] # If we are in the main group. if cell == False: - if name == 'title': + if name == 'TITLE': self.title = self.decode(self.unescape(value)) - elif name == 'Author': + elif name == 'AUTHOR': author = self.decode(self.unescape(value)) if len(author): self.addAuthor(author) - elif name == 'Copyright': + elif name == 'COPYRIGHT': self.copyright = self.decode(self.unescape(value)) elif name[0:4] == 'CELL': self.parse(value, cell = name[4:]) @@ -142,13 +142,13 @@ class SundayPlusImport(SongImport): if len(value) >= 2 and value[-1] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: verse_type = "%s%s" % (verse_type, value[-1]) - elif name == 'Hotkey': + elif name == 'HOTKEY': # Hotkey always appears after MARKER_NAME, so it # effectively overrides MARKER_NAME, if present. if len(value) and \ value in HOTKEY_TO_VERSE_TYPE.keys(): verse_type = HOTKEY_TO_VERSE_TYPE[value] - if name == 'rtf': + if name == 'RTF': value = self.unescape(value) result = strip_rtf(value, self.encoding) if result is None: From 0c3985f88ef788cb56952d0ab368c36340ac1ab3 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Sun, 18 Aug 2013 20:44:48 +0000 Subject: [PATCH 2/2] added file open mode --- openlp/plugins/songs/lib/sundayplusimport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/sundayplusimport.py index cd72cc564..410c35e88 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/sundayplusimport.py @@ -68,7 +68,7 @@ class SundayPlusImport(SongImport): for filename in self.importSource: if self.stopImportFlag: return - song_file = open(filename) + song_file = open(filename, 'rb') self.doImportFile(song_file) song_file.close()