← 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/71616

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/71616
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-15 23:00:26 +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-15 23:00:26 +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-15 23:00:26 +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')


Follow ups