diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 58af0edd4..baaec12e7 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -151,7 +151,7 @@ class OpenSongImport(SongImport): self.do_import_file(file) if self.commit: self.finish() - if not self.commit: + if self.commit: self.finish() @@ -296,5 +296,6 @@ class OpenSongImport(SongImport): self.topics = topics self.verse_order_list = verse_order_list self.verses = verselist - xxx sort out where to call setdefaults - xxx need to make calls to insert to database here + + # xxx sort out where to call setdefaults + # xxx need to make calls to insert to database here diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 622f139bd..5a4033280 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -52,16 +52,16 @@ class SongImport(QtCore.QObject): """ self.manager = manager self.stop_import_flag = False - self.set_defaults() QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_stop_import'), self.stop_import) - self.setDefaults() + self.set_defaults() - def setDefaults(self): + def set_defaults(self): """ Create defaults for properties - call this before each song if importing many songs at once to ensure a clean beginning """ + self.authors = [] self.title = u'' self.song_number = u'' self.alternate_title = u'' @@ -251,6 +251,7 @@ class SongImport(QtCore.QObject): """ Write the song and its fields to disk """ + log.info(u'commiting song %s to database', self.title) song = Song() song.title = self.title song.search_title = self.remove_punctuation(self.title) \ diff --git a/openlp/plugins/songs/lib/test/test_opensongimport.py b/openlp/plugins/songs/lib/test/test_opensongimport.py index f2fcb8cd2..eabcce7e5 100644 --- a/openlp/plugins/songs/lib/test/test_opensongimport.py +++ b/openlp/plugins/songs/lib/test/test_opensongimport.py @@ -69,9 +69,9 @@ def test(): assert o.topics == [u'TestTheme', u'TestAltTheme'] o.filenames = [u'test.opensong.zip'] + o.set_defaults() o.do_import() o.print_song() - o.finish() assert o.copyright == u'2010 Martin Thompson' assert o.authors == [u'MartiÑ Thómpson'] assert o.title == u'Martins Test' @@ -87,8 +87,8 @@ def test(): assert o.verse_order_list == [u'V1', u'C1', u'V2', u'C2', u'V3', u'B1', u'V1'] o.filenames = [u'test2.opensong'] + o.set_defaults() o.do_import() - # o.finish() o.print_song() assert o.copyright == u'2010 Martin Thompson' assert o.authors == [u'Martin Thompson'] @@ -106,8 +106,8 @@ def test(): assert o.verse_order_list == [u'V1', u'V2', u'B1', u'C1', u'C2'] o.filenames = [u'test3.opensong'] + o.set_defaults() o.do_import() - # o.finish() o.print_song() assert o.copyright == u'2010' assert o.authors == [u'Martin Thompson']