[Openlp-core] [Merge] lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4

2016-09-23 Thread Raoul Snyman
The proposal to merge lp:~tomasgroth/openlp/24bugfix-backport5 into 
lp:openlp/2.4 has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/24bugfix-backport5/+merge/306677
-- 
Your team OpenLP Core is subscribed to branch lp:openlp/2.4.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4

2016-09-23 Thread Raoul Snyman
Review: Approve


-- 
https://code.launchpad.net/~tomasgroth/openlp/24bugfix-backport5/+merge/306677
Your team OpenLP Core is subscribed to branch lp:openlp/2.4.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp

2016-09-23 Thread Phill
Review: Approve

Looks ok to me, but I've not tested it!
-- 
https://code.launchpad.net/~tomasgroth/openlp/25bugfixes5/+merge/306676
Your team OpenLP Core is requested to review the proposed merge of 
lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] [Merge] lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4

2016-09-23 Thread Tomas Groth
Tomas Groth has proposed merging lp:~tomasgroth/openlp/24bugfix-backport5 into 
lp:openlp/2.4.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1618489 in OpenLP: "Improper characters in Mediashout import cause 
traceback"
  https://bugs.launchpad.net/openlp/+bug/1618489

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/24bugfix-backport5/+merge/306677

Fixes getting bible texts from CrossWalk
Fix to handling of form feed char and vertical tab char.
-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2016-07-27 19:27:14 +
+++ openlp/plugins/bibles/lib/http.py	2016-09-23 22:26:31 +
@@ -480,7 +480,7 @@
 for verse in verses_div:
 self.application.process_events()
 verse_number = int(verse.find('strong').contents[0])
-verse_span = verse.find('span')
+verse_span = verse.find('span', class_='verse-%d' % verse_number)
 tags_to_remove = verse_span.find_all(['a', 'sup'])
 for tag in tags_to_remove:
 tag.decompose()

=== modified file 'openlp/plugins/songs/lib/importers/mediashout.py'
--- openlp/plugins/songs/lib/importers/mediashout.py	2016-06-16 20:58:11 +
+++ openlp/plugins/songs/lib/importers/mediashout.py	2016-09-23 22:26:31 +
@@ -93,7 +93,7 @@
 self.song_book_name = song.SongID
 for verse in verses:
 tag = VERSE_TAGS[verse.Type] + str(verse.Number) if verse.Type < len(VERSE_TAGS) else 'O'
-self.add_verse(verse.Text, tag)
+self.add_verse(self.tidy_text(verse.Text), tag)
 for order in verse_order:
 if order.Type < len(VERSE_TAGS):
 self.verse_order_list.append(VERSE_TAGS[order.Type] + str(order.Number))

=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
--- openlp/plugins/songs/lib/importers/songimport.py	2016-04-21 19:49:22 +
+++ openlp/plugins/songs/lib/importers/songimport.py	2016-09-23 22:26:31 +
@@ -140,10 +140,13 @@
 text = text.replace('\u2026', '...')
 text = text.replace('\u2013', '-')
 text = text.replace('\u2014', '-')
+# Replace vertical tab with 2 linebreaks
+text = text.replace('\v', '\n\n')
+# Replace form feed (page break) with 2 linebreaks
+text = text.replace('\f', '\n\n')
 # Remove surplus blank lines, spaces, trailing/leading spaces
-text = re.sub(r'[ \t\v]+', ' ', text)
+text = re.sub(r'[ \t]+', ' ', text)
 text = re.sub(r' ?(\r\n?|\n) ?', '\n', text)
-text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
 return text
 
 def process_song_text(self, text):

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4

2016-09-23 Thread Tomas Groth
lp:~tomasgroth/openlp/24bugfix-backport5 (revision 2654)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1782/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1693/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1631/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1387/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/977/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1045/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/913/

-- 
https://code.launchpad.net/~tomasgroth/openlp/24bugfix-backport5/+merge/306677
Your team OpenLP Core is requested to review the proposed merge of 
lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] [Bug 1618489] Re: Improper characters in Mediashout import cause traceback

2016-09-23 Thread Launchpad Bug Tracker
** Branch linked: lp:~tomasgroth/openlp/24bugfix-backport5

-- 
You received this bug notification because you are a member of OpenLP
Core, which is subscribed to OpenLP.
https://bugs.launchpad.net/bugs/1618489

Title:
  Improper characters in Mediashout import cause traceback

Status in OpenLP:
  New

Bug description:
  If Mediashout import has improper characters, the importer causes a
  traceback:

  --- Exception Traceback --- Traceback (most recent call last): 
  File "openlp\core\ui\wizard.py", line 216, in on_current_id_changed 
  File "openlp\plugins\songs\forms\songimportform.py", line 351, in 
perform_wizard 
  File "openlp\plugins\songs\lib\importers\mediashout.py", line 77, in 
do_import 
  File "openlp\plugins\songs\lib\importers\mediashout.py", line 100, in 
process_song 
  File "openlp\plugins\songs\lib\importers\songimport.py", line 353, in finish 
  File "openlp\plugins\songs\lib\openlyricsxml.py", line 102, in 
add_verse_to_lyrics 
  File "lxml.etree.pyx", line 2972, in lxml.etree.CDATA.__cinit__ 
(src\lxml\lxml.etree.c:69195) 
  File "apihelpers.pxi", line 1393, in lxml.etree._utf8 
(src\lxml\lxml.etree.c:27125) 
  ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL 
bytes or control characters

  Such a file can be found in the db provided in here:
  https://support.openlp.org/scp/tickets.php?id=3690

  Such characters can be found in the database on:
  Verses > record > 2856.

  Here’s a screen capture of the characters,
  I’m unable to copy them.
  https://drive.google.com/file/d/0B9y8rZiYItltcHBpUUt0OWR4aGc/view?usp=sharing

  Copy-paste sample:
  “That covers me and
  Raised this dead man's life
  It's all because of
  Jesus I'm alive”

  Win 10 | 2.4.2

To manage notifications about this bug go to:
https://bugs.launchpad.net/openlp/+bug/1618489/+subscriptions

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp


[Openlp-core] [Merge] lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp

2016-09-23 Thread Tomas Groth
Tomas Groth has proposed merging lp:~tomasgroth/openlp/25bugfixes5 into 
lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #1618489 in OpenLP: "Improper characters in Mediashout import cause 
traceback"
  https://bugs.launchpad.net/openlp/+bug/1618489

For more details, see:
https://code.launchpad.net/~tomasgroth/openlp/25bugfixes5/+merge/306676

Fixes getting bible texts from CrossWalk
Fix to handling of form feed char and vertical tab char.
-- 
Your team OpenLP Core is requested to review the proposed merge of 
lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/importers/http.py'
--- openlp/plugins/bibles/lib/importers/http.py	2016-08-20 20:32:25 +
+++ openlp/plugins/bibles/lib/importers/http.py	2016-09-23 22:02:08 +
@@ -493,7 +493,7 @@
 for verse in verses_div:
 self.application.process_events()
 verse_number = int(verse.find('strong').contents[0])
-verse_span = verse.find('span')
+verse_span = verse.find('span', class_='verse-%d' % verse_number)
 tags_to_remove = verse_span.find_all(['a', 'sup'])
 for tag in tags_to_remove:
 tag.decompose()

=== modified file 'openlp/plugins/songs/lib/importers/mediashout.py'
--- openlp/plugins/songs/lib/importers/mediashout.py	2016-06-14 20:36:51 +
+++ openlp/plugins/songs/lib/importers/mediashout.py	2016-09-23 22:02:08 +
@@ -101,7 +101,7 @@
 self.song_book_name = song.SongID
 for verse in verses:
 tag = VERSE_TAGS[verse.Type] + str(verse.Number) if verse.Type < len(VERSE_TAGS) else 'O'
-self.add_verse(verse.Text, tag)
+self.add_verse(self.tidy_text(verse.Text), tag)
 for order in verse_order:
 if order.Type < len(VERSE_TAGS):
 self.verse_order_list.append(VERSE_TAGS[order.Type] + str(order.Number))

=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
--- openlp/plugins/songs/lib/importers/songimport.py	2016-05-27 08:13:14 +
+++ openlp/plugins/songs/lib/importers/songimport.py	2016-09-23 22:02:08 +
@@ -140,10 +140,13 @@
 text = text.replace('\u2026', '...')
 text = text.replace('\u2013', '-')
 text = text.replace('\u2014', '-')
+# Replace vertical tab with 2 linebreaks
+text = text.replace('\v', '\n\n')
+# Replace form feed (page break) with 2 linebreaks
+text = text.replace('\f', '\n\n')
 # Remove surplus blank lines, spaces, trailing/leading spaces
-text = re.sub(r'[ \t\v]+', ' ', text)
+text = re.sub(r'[ \t]+', ' ', text)
 text = re.sub(r' ?(\r\n?|\n) ?', '\n', text)
-text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
 return text
 
 def process_song_text(self, text):

=== modified file 'tests/functional/openlp_plugins/songs/test_mediashout.py'
--- tests/functional/openlp_plugins/songs/test_mediashout.py	2016-08-14 20:58:27 +
+++ tests/functional/openlp_plugins/songs/test_mediashout.py	2016-09-23 22:02:08 +
@@ -22,15 +22,20 @@
 """
 Test the MediaShout importer
 """
-from unittest import TestCase
+from unittest import TestCase, skipUnless
 from collections import namedtuple
 
 from openlp.core.common import Registry
-from openlp.plugins.songs.lib.importers.mediashout import MediaShoutImport
+try:
+from openlp.plugins.songs.lib.importers.mediashout import MediaShoutImport
+CAN_RUN_TESTS = True
+except ImportError:
+CAN_RUN_TESTS = False
 
 from tests.functional import MagicMock, patch, call
 
 
+@skipUnless(CAN_RUN_TESTS, 'Not Windows, skipping test')
 class TestMediaShoutImport(TestCase):
 """
 Test the MediaShout importer

=== modified file 'tests/interfaces/openlp_plugins/bibles/test_lib_http.py'
--- tests/interfaces/openlp_plugins/bibles/test_lib_http.py	2016-08-20 20:00:50 +
+++ tests/interfaces/openlp_plugins/bibles/test_lib_http.py	2016-09-23 22:02:08 +
@@ -163,3 +163,19 @@
 # THEN: The list should not be None, and some known bibles should be there
 self.assertIsNotNone(bibles)
 self.assertIn(('Giovanni Diodati 1649 (Italian)', 'gdb', 'it'), bibles)
+
+def test_crosswalk_get_verse_text(self):
+"""
+Test verse text from Crosswalk.com
+"""
+# GIVEN: A new Crosswalk extraction class
+handler = CWExtract()
+
+# WHEN: downloading NIV Genesis from Crosswalk
+niv_genesis_chapter_one = handler.get_bible_chapter('niv', 'Genesis', 1)
+
+# THEN: The verse list should contain the verses
+self.assertTrue(niv_genesis_chapter_one.has_verse_list())
+self.assertEquals('In the beginning God created the heavens and the earth.',
+  niv_genesis_chapter_one.verse_list[1],
+  'The first chapter of genesis should have been fetched.')

___
Mailing list: 

Re: [Openlp-core] [Merge] lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp

2016-09-23 Thread Tomas Groth
lp:~tomasgroth/openlp/25bugfixes5 (revision 2700)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1781/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1692/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1630/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1386/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/976/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/1044/
[SUCCESS] https://ci.openlp.io/job/Branch-05b-Test_Coverage/912/
[SUCCESS] https://ci.openlp.io/job/Branch-05c-Code_Analysis2/75/

-- 
https://code.launchpad.net/~tomasgroth/openlp/25bugfixes5/+merge/306676
Your team OpenLP Core is requested to review the proposed merge of 
lp:~tomasgroth/openlp/25bugfixes5 into lp:openlp.

___
Mailing list: https://launchpad.net/~openlp-core
Post to : openlp-core@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openlp-core
More help   : https://help.launchpad.net/ListHelp