From e8c7547ab25a956f23a2ce071efc8d6c61f91f26 Mon Sep 17 00:00:00 2001 From: Samuel Mehrbrodt Date: Sat, 3 May 2014 10:47:31 +0200 Subject: [PATCH] Try to get ccli number even if there is text in the field --- openlp/plugins/songs/lib/songshowplusimport.py | 8 ++++---- .../songshowplussongs/a mighty fortress is our god.json | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index c1c6d04cb..fe81b61a2 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -147,10 +147,10 @@ class SongShowPlusImport(SongImport): elif block_key == COPYRIGHT: self.add_copyright(self.decode(data)) elif block_key == CCLI_NO: - try: - self.ccli_number = int(data) - except ValueError: - continue + # Try to get the CCLI number even if the field contains additional text + match = re.search(r'\d+', self.decode(data)) + if match: + self.ccli_number = int(match.group()) elif block_key == VERSE: self.add_verse(self.decode(data), "%s%s" % (VerseType.tags[VerseType.Verse], verse_no)) elif block_key == CHORUS: diff --git a/tests/resources/songshowplussongs/a mighty fortress is our god.json b/tests/resources/songshowplussongs/a mighty fortress is our god.json index 2ab95781d..2788ad05c 100644 --- a/tests/resources/songshowplussongs/a mighty fortress is our god.json +++ b/tests/resources/songshowplussongs/a mighty fortress is our god.json @@ -2,6 +2,7 @@ "authors": [ "Martin Luther" ], + "ccli_number": 12456, "comments": "", "copyright": "Public Domain", "song_number": 0,