From 7ab1538460ee5762d00a0f5330a78edfcaaefdce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Mon, 15 Aug 2011 12:54:07 +0300 Subject: [PATCH 1/7] Supposed to fix #819271, crash when downloading some chapters. --- openlp/plugins/bibles/lib/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 290da104c..2d8e16c4c 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -218,7 +218,7 @@ class BSExtract(object): 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') From aca0a86915e050546f30a5d64d0c7127216da933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 01:42:48 +0300 Subject: [PATCH 2/7] Fix comparison of always unequal unicode and non-unicode string on drag-and-drop. --- openlp/core/lib/mediamanageritem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index a721fabf6..4bf3732e6 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -377,7 +377,7 @@ class MediaManagerItem(QtGui.QWidget): """ 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: From bdde2a4fb4e8e6c885e14eb028d550d0ee5ff1b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 01:44:02 +0300 Subject: [PATCH 3/7] String fix. --- openlp/core/lib/mediamanageritem.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 4bf3732e6..f21d8df50 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -396,7 +396,7 @@ class MediaManagerItem(QtGui.QWidget): 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) From a3ddb50479ef90b615a6d1996cb64e5a07eb46b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 01:46:31 +0300 Subject: [PATCH 4/7] Now we do not read several GB video files entirely into memory when opening service, this also fixes #257 in tracker. --- openlp/core/ui/servicemanager.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 3ab2e9239..5bb396bf1 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -584,8 +584,8 @@ class ServiceManager(QtGui.QWidget): 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 @@ class ServiceManager(QtGui.QWidget): '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') From bbba7203e324a4da82c749c41ac38c36c7234670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 03:08:16 +0300 Subject: [PATCH 5/7] Fix #249 on tracker, exception on opensong files with verse name containing only number [1] --- openlp/plugins/songs/lib/__init__.py | 9 +++++---- openlp/plugins/songs/lib/opensongimport.py | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index e2996ff8f..1b0ca316e 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -184,10 +184,11 @@ class VerseType(object): 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): diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index 7fca88262..afdf3fe63 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -191,6 +191,8 @@ class OpenSongImport(SongImport): verse_tag = content verse_num = u'1' verse_index = VerseType.from_loose_input(verse_tag) + if not verse_index: + verse_index = 0 # Verse verse_tag = VerseType.Tags[verse_index] inst = 1 if [verse_tag, verse_num, inst] in our_verse_order \ From 509bc9e7044a8fdd2814521a7b8c1519c799d57a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 03:59:45 +0300 Subject: [PATCH 6/7] Two last importers, which did not stop on cancel. --- openlp/plugins/songs/lib/songshowplusimport.py | 2 ++ openlp/plugins/songs/lib/wowimport.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index 7f7527c6d..9a21d33b9 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -104,6 +104,8 @@ class SongShowPlusImport(SongImport): 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 = {} diff --git a/openlp/plugins/songs/lib/wowimport.py b/openlp/plugins/songs/lib/wowimport.py index e2a5820a5..4cfb81cb1 100644 --- a/openlp/plugins/songs/lib/wowimport.py +++ b/openlp/plugins/songs/lib/wowimport.py @@ -105,6 +105,8 @@ class WowImport(SongImport): 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] From da758fbb897a1c6a1028b6edda7d5d3d952c25c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20P=C3=B5ldaru?= Date: Tue, 16 Aug 2011 11:46:55 +0300 Subject: [PATCH 7/7] Removed wrong comment --- openlp/plugins/songs/lib/opensongimport.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/opensongimport.py b/openlp/plugins/songs/lib/opensongimport.py index afdf3fe63..632170807 100644 --- a/openlp/plugins/songs/lib/opensongimport.py +++ b/openlp/plugins/songs/lib/opensongimport.py @@ -190,9 +190,10 @@ class OpenSongImport(SongImport): # the verse tag verse_tag = content verse_num = u'1' - verse_index = VerseType.from_loose_input(verse_tag) - if not verse_index: - verse_index = 0 # Verse + 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 \