← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~sam92/openlp/bug-1326664-2.0 into lp:openlp/2.0

 

Samuel Mehrbrodt has proposed merging lp:~sam92/openlp/bug-1326664-2.0 into lp:openlp/2.0.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1326664 in OpenLP: "Can't import EasyWorship DB"
  https://bugs.launchpad.net/openlp/+bug/1326664

For more details, see:
https://code.launchpad.net/~sam92/openlp/bug-1326664-2.0/+merge/222473

Add proper error messages to EasyWorship import.
Also make sure that Songs.db (lowercase ending) is also being recognized.
-- 
https://code.launchpad.net/~sam92/openlp/bug-1326664-2.0/+merge/222473
Your team OpenLP Core is requested to review the proposed merge of lp:~sam92/openlp/bug-1326664-2.0 into lp:openlp/2.0.
=== modified file 'openlp/plugins/songs/lib/ewimport.py'
--- openlp/plugins/songs/lib/ewimport.py	2014-05-20 16:19:06 +0000
+++ openlp/plugins/songs/lib/ewimport.py	2014-06-09 08:22:57 +0000
@@ -64,13 +64,21 @@
 
     def doImport(self):
         # Open the DB and MB files if they exist
-        import_source_mb = self.importSource.replace('.DB', '.MB')
+        import_source_mb = self.importSource.replace('.DB', '.MB').replace('.db', '.mb')
         if not os.path.isfile(self.importSource):
+            self.logError(self.importSource, translate('SongsPlugin.EasyWorshipSongImport',
+                                                         'This file does not exist.'))
+            return
             return
         if not os.path.isfile(import_source_mb):
+            self.logError(self.importSource, translate('SongsPlugin.EasyWorshipSongImport',
+                                                         'Could not find the "Songs.MB" file. It must be in the same '
+                                                         'folder as the "Songs.DB" file.'))
             return
         db_size = os.path.getsize(self.importSource)
         if db_size < 0x800:
+            self.logError(self.importSource, translate('SongsPlugin.EasyWorshipSongImport',
+                                                         'This file is no valid EasyWorship Database.'))
             return
         db_file = open(self.importSource, 'rb')
         self.memoFile = open(import_source_mb, 'rb')
@@ -80,6 +88,8 @@
         if header_size != 0x800 or block_size < 1 or block_size > 4:
             db_file.close()
             self.memoFile.close()
+            self.logError(self.importSource, translate('SongsPlugin.EasyWorshipSongImport',
+                                                         'This file is no valid EasyWorship Database.'))
             return
         # Take a stab at how text is encoded
         self.encoding = u'cp1252'


Follow ups