diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 1a5c94a39..df8492976 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -118,6 +118,8 @@ class OpenSongImport: self.do_import_file(file) if commit: self.finish() + + def do_import_file(self, file): """ Process the OpenSong file - pass in a file-like object, not a filename @@ -135,6 +137,13 @@ class OpenSongImport: for (attr, fn) in decode.items(): if attr in fields: fn(unicode(root.__getattr__(attr))) + + res = [] + if u'theme' in fields: + res.append(unicode(root.theme)) + if u'alttheme' in fields: + res.append(unicode(root.alttheme)) + self.song.theme=u', '.join(res) # data storage while importing verses = {} diff --git a/openlp/plugins/songs/lib/test/test_opensongimport.py b/openlp/plugins/songs/lib/test/test_opensongimport.py index a027042a7..c1025d4fe 100644 --- a/openlp/plugins/songs/lib/test/test_opensongimport.py +++ b/openlp/plugins/songs/lib/test/test_opensongimport.py @@ -30,7 +30,7 @@ def test(): manager = SongManager() o = OpenSongImport(manager) o.do_import(u'test.opensong', commit=False) - # o.finish() + o.finish() o.song.print_song() assert o.song.copyright == u'2010 Martin Thompson' assert o.song.authors == [u'MartiÑ Thómpson'] @@ -45,7 +45,8 @@ def test(): assert [u'V2', u'v2 Line 1\nV2 Line 2'] in o.song.verses assert o.song.verse_order_list == [u'V1', u'C', u'V2', u'C2', u'V3', u'B1', u'V1'] assert o.song.ccli_number == u'Blah' - + print u':%s:'%o.song.theme + assert o.song.theme == u'TestTheme, TestAltTheme' o.do_import(u'test.opensong.zip', commit=False) # o.finish() o.song.print_song()