← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/some_fixes into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/some_fixes into lp:openlp.

Requested reviews:
  Tim Bentley (trb143)
Related bugs:
  Bug #819271 in OpenLP: "Web NIV download from Bibleserver crashes if book only has 1 chapter eg Philemon"
  https://bugs.launchpad.net/openlp/+bug/819271

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/some_fixes/+merge/71648

This seems to fix #819271, web NIV download from Bibleserver crash.
No crash (#257) and performance jump and reduced memory usage on loading services with huge files.
Fixed filename comparison on drag and drop.
-- 
https://code.launchpad.net/~mahfiaz/openlp/some_fixes/+merge/71648
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/mediamanageritem.py'
--- openlp/core/lib/mediamanageritem.py	2011-08-02 18:17:07 +0000
+++ openlp/core/lib/mediamanageritem.py	2011-08-16 08:48:31 +0000
@@ -377,7 +377,7 @@
         """
         names = []
         for count in range(0, self.listView.count()):
-            names.append(self.listView.item(count).text())
+            names.append(unicode(self.listView.item(count).text()))
         newFiles = []
         duplicatesFound = False
         for file in files:
@@ -396,7 +396,7 @@
             critical_error_message_box(
                 UiStrings().Duplicate,
                 unicode(translate('OpenLP.MediaManagerItem',
-                'Duplicate files found on import and ignored.')))
+                'Duplicate files were found on import and were ignored.')))
 
     def contextMenu(self, point):
         item = self.listView.itemAt(point)

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2011-08-14 13:05:39 +0000
+++ openlp/core/ui/servicemanager.py	2011-08-16 08:48:31 +0000
@@ -584,8 +584,8 @@
         fileTo = None
         try:
             zip = zipfile.ZipFile(fileName)
-            for file in zip.namelist():
-                ucsfile = file_is_unicode(file)
+            for zipinfo in zip.infolist():
+                ucsfile = file_is_unicode(zipinfo.filename)
                 if not ucsfile:
                     critical_error_message_box(
                         message=translate('OpenLP.ServiceManager',
@@ -593,14 +593,11 @@
                         'The content encoding is not UTF-8.'))
                     continue
                 osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
-                filePath = os.path.join(self.servicePath,
-                    os.path.split(osfile)[1])
-                fileTo = open(filePath, u'wb')
-                fileTo.write(zip.read(file))
-                fileTo.flush()
-                fileTo.close()
-                if filePath.endswith(u'osd'):
-                    p_file = filePath
+                filename_only = os.path.split(osfile)[1]
+                zipinfo.filename = filename_only
+                zip.extract(zipinfo, self.servicePath)
+                if filename_only.endswith(u'osd'):
+                    p_file = os.path.join(self.servicePath, filename_only)
             if 'p_file' in locals():
                 Receiver.send_message(u'cursor_busy')
                 fileTo = open(p_file, u'r')

=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2011-07-14 18:42:38 +0000
+++ openlp/plugins/bibles/lib/http.py	2011-08-16 08:48:31 +0000
@@ -218,7 +218,7 @@
             send_error_message(u'parse')
             return None
         content = content.find(u'div').findAll(u'div')
-        verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse')
+        verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse.*')
         verses = {}
         for verse in content:
             Receiver.send_message(u'openlp_process_events')

=== modified file 'openlp/plugins/songs/lib/__init__.py'
--- openlp/plugins/songs/lib/__init__.py	2011-07-08 06:40:50 +0000
+++ openlp/plugins/songs/lib/__init__.py	2011-08-16 08:48:31 +0000
@@ -184,10 +184,11 @@
             verse_index = VerseType.from_translated_string(verse_name)
             if verse_index is None:
                 verse_index = VerseType.from_string(verse_name)
-        if verse_index is None:
-            verse_index = VerseType.from_translated_tag(verse_name)
-        if verse_index is None:
-            verse_index = VerseType.from_tag(verse_name)
+        elif len(verse_name) == 1:
+            if verse_index is None:
+                verse_index = VerseType.from_translated_tag(verse_name)
+            if verse_index is None:
+                verse_index = VerseType.from_tag(verse_name)
         return verse_index
 
 def retrieve_windows_encoding(recommendation=None):

=== modified file 'openlp/plugins/songs/lib/opensongimport.py'
--- openlp/plugins/songs/lib/opensongimport.py	2011-07-17 12:59:26 +0000
+++ openlp/plugins/songs/lib/opensongimport.py	2011-08-16 08:48:31 +0000
@@ -190,7 +190,10 @@
                     # the verse tag
                     verse_tag = content
                     verse_num = u'1'
-                verse_index = VerseType.from_loose_input(verse_tag)
+                if len(verse_tag) == 0:
+                    verse_index = 0
+                else:
+                    verse_index = VerseType.from_loose_input(verse_tag)
                 verse_tag = VerseType.Tags[verse_index]
                 inst = 1
                 if [verse_tag, verse_num, inst] in our_verse_order \

=== modified file 'openlp/plugins/songs/lib/songshowplusimport.py'
--- openlp/plugins/songs/lib/songshowplusimport.py	2011-06-14 05:45:23 +0000
+++ openlp/plugins/songs/lib/songshowplusimport.py	2011-08-16 08:48:31 +0000
@@ -104,6 +104,8 @@
         self.import_wizard.progressBar.setMaximum(len(self.import_source))
 
         for file in self.import_source:
+            if self.stop_import_flag:
+                return
             self.sspVerseOrderList = []
             otherCount = 0
             otherList = {}

=== modified file 'openlp/plugins/songs/lib/wowimport.py'
--- openlp/plugins/songs/lib/wowimport.py	2011-07-07 18:03:12 +0000
+++ openlp/plugins/songs/lib/wowimport.py	2011-08-16 08:48:31 +0000
@@ -105,6 +105,8 @@
         if isinstance(self.import_source, list):
             self.import_wizard.progressBar.setMaximum(len(self.import_source))
             for file in self.import_source:
+                if self.stop_import_flag:
+                    return
                 file_name = os.path.split(file)[1]
                 # Get the song title
                 self.title = file_name.rpartition(u'.')[0]


Follow ups