Merge lp:~tomasgroth/openlp/more-song-import-formats into lp:openlp

Proposed by Tomas Groth
Status: Merged
Merged at revision: 2575
Proposed branch: lp:~tomasgroth/openlp/more-song-import-formats
Merge into: lp:openlp
Diff against target: 1108 lines (+742/-133)
21 files modified
openlp/plugins/songs/lib/importer.py (+24/-1)
openlp/plugins/songs/lib/importers/cclifile.py (+4/-4)
openlp/plugins/songs/lib/importers/lyrix.py (+115/-0)
openlp/plugins/songs/lib/importers/songimport.py (+5/-5)
openlp/plugins/songs/lib/importers/videopsalm.py (+123/-0)
tests/functional/openlp_plugins/songs/test_lyriximport.py (+53/-0)
tests/functional/openlp_plugins/songs/test_songbeamerimport.py (+16/-60)
tests/functional/openlp_plugins/songs/test_songselect.py (+19/-62)
tests/functional/openlp_plugins/songs/test_videopsalm.py (+49/-0)
tests/helpers/songfileimport.py (+4/-1)
tests/resources/lyrixsongs/A002.TXT (+34/-0)
tests/resources/lyrixsongs/A06.TXT (+31/-0)
tests/resources/lyrixsongs/AO05.TXT (+48/-0)
tests/resources/lyrixsongs/Amazing Grace.json (+26/-0)
tests/resources/lyrixsongs/Amazing Grace2.json (+33/-0)
tests/resources/lyrixsongs/in die regterhand.json (+18/-0)
tests/resources/songbeamersongs/Lobsinget dem Herrn.json (+12/-0)
tests/resources/songselect/TestSong-bin.json (+25/-0)
tests/resources/songselect/TestSong-txt.json (+21/-0)
tests/resources/videopsalmsongs/as-safe-a-stronghold.json (+35/-0)
tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json (+47/-0)
To merge this branch: bzr merge lp:~tomasgroth/openlp/more-song-import-formats
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Tim Bentley Approve
Review via email: mp+281039@code.launchpad.net

Description of the change

Added importer for Lyrix and VideoPsalm + tests.
Added support for author-type in importers.
Migrated songselect and songbeamer tests to the SongImportTestHelper based structure.

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote :

lp:~tomasgroth/openlp/more-song-import-formats (revision 2579)
[SUCCESS] https//ci.openlp.io/job/Branch-01-Pull/1196/
[SUCCESS] https//ci.openlp.io/job/Branch-02-Functional-Tests/1119/
[SUCCESS] https//ci.openlp.io/job/Branch-03-Interface-Tests/1060/
[SUCCESS] https//ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/907/
[SUCCESS] https//ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/503/
[SUCCESS] https//ci.openlp.io/job/Branch-05a-Code_Analysis/618/
[SUCCESS] https//ci.openlp.io/job/Branch-05b-Test_Coverage/489/

Revision history for this message
Tim Bentley (trb143) :
review: Approve
Revision history for this message
Raoul Snyman (raoul-snyman) wrote :

Looks fine to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/songs/lib/importer.py'
2--- openlp/plugins/songs/lib/importer.py 2015-08-26 07:26:19 +0000
3+++ openlp/plugins/songs/lib/importer.py 2015-12-20 19:34:43 +0000
4@@ -46,6 +46,8 @@
5 from .importers.worshipassistant import WorshipAssistantImport
6 from .importers.powerpraise import PowerPraiseImport
7 from .importers.presentationmanager import PresentationManagerImport
8+from .importers.lyrix import LyrixImport
9+from .importers.videopsalm import VideoPsalmImport
10
11 log = logging.getLogger(__name__)
12
13@@ -166,6 +168,8 @@
14 WorshipAssistant = 21
15 WorshipCenterPro = 22
16 ZionWorx = 23
17+ Lyrix = 24
18+ VideoPsalm = 25
19
20 # Set optional attribute defaults
21 __defaults__ = {
22@@ -244,6 +248,13 @@
23 'prefix': 'foilPresenter',
24 'filter': '%s (*.foil)' % translate('SongsPlugin.ImportWizardForm', 'Foilpresenter Song Files')
25 },
26+ Lyrix: {
27+ 'class': LyrixImport,
28+ 'name': 'LyriX',
29+ 'prefix': 'lyrix',
30+ 'filter': '%s (*.txt)' % translate('SongsPlugin.ImportWizardForm', 'LyriX Files'),
31+ 'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'LyriX (Exported TXT-files)')
32+ },
33 MediaShout: {
34 'name': 'MediaShout',
35 'prefix': 'mediaShout',
36@@ -324,6 +335,16 @@
37 'prefix': 'sundayPlus',
38 'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')
39 },
40+ VideoPsalm: {
41+ 'class': VideoPsalmImport,
42+ 'name': 'VideoPsalm',
43+ 'prefix': 'videopsalm',
44+ 'selectMode': SongFormatSelect.SingleFile,
45+ 'filter': '%s (*.json)' % translate('SongsPlugin.ImportWizardForm', 'VideoPsalm Files'),
46+ 'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'VideoPsalm'),
47+ 'descriptionText': translate('SongsPlugin.ImportWizardForm', 'The VideoPsalm songbooks are normally located'
48+ ' in %s') % 'C:\\Users\\Public\\Documents\\VideoPsalm\\SongBooks\\'
49+ },
50 WordsOfWorship: {
51 'class': WordsOfWorshipImport,
52 'name': 'Words of Worship',
53@@ -393,7 +414,9 @@
54 SongFormat.WordsOfWorship,
55 SongFormat.WorshipAssistant,
56 SongFormat.WorshipCenterPro,
57- SongFormat.ZionWorx
58+ SongFormat.ZionWorx,
59+ SongFormat.Lyrix,
60+ SongFormat.VideoPsalm
61 ]
62
63 @staticmethod
64
65=== modified file 'openlp/plugins/songs/lib/importers/cclifile.py'
66--- openlp/plugins/songs/lib/importers/cclifile.py 2015-01-18 13:39:21 +0000
67+++ openlp/plugins/songs/lib/importers/cclifile.py 2015-12-20 19:34:43 +0000
68@@ -48,7 +48,7 @@
69 :param manager: The song manager for the running OpenLP installation.
70 :param kwargs: The files to be imported.
71 """
72- SongImport.__init__(self, manager, **kwargs)
73+ super(CCLIFileImport, self).__init__(manager, **kwargs)
74
75 def do_import(self):
76 """
77@@ -161,7 +161,7 @@
78 elif line.startswith('Author='):
79 song_author = line[7:].strip()
80 elif line.startswith('Copyright='):
81- self.copyright = line[10:].strip()
82+ self.add_copyright(line[10:].strip())
83 elif line.startswith('Themes='):
84 song_topics = line[7:].strip().replace(' | ', '/t')
85 elif line.startswith('Fields='):
86@@ -318,14 +318,14 @@
87 if line_number == 2:
88 line_number += 1
89 if clean_line.startswith('©'):
90- self.copyright = clean_line
91+ self.add_copyright(clean_line)
92 else:
93 song_author = clean_line
94 # n=3, authors
95 elif line_number == 3:
96 line_number += 1
97 if song_author:
98- self.copyright = clean_line
99+ self.add_copyright(clean_line)
100 else:
101 song_author = clean_line
102 # line_number=4, comments lines before last line
103
104=== added file 'openlp/plugins/songs/lib/importers/lyrix.py'
105--- openlp/plugins/songs/lib/importers/lyrix.py 1970-01-01 00:00:00 +0000
106+++ openlp/plugins/songs/lib/importers/lyrix.py 2015-12-20 19:34:43 +0000
107@@ -0,0 +1,115 @@
108+# -*- coding: utf-8 -*-
109+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
110+
111+###############################################################################
112+# OpenLP - Open Source Lyrics Projection #
113+# --------------------------------------------------------------------------- #
114+# Copyright (c) 2008-2015 OpenLP Developers #
115+# --------------------------------------------------------------------------- #
116+# This program is free software; you can redistribute it and/or modify it #
117+# under the terms of the GNU General Public License as published by the Free #
118+# Software Foundation; version 2 of the License. #
119+# #
120+# This program is distributed in the hope that it will be useful, but WITHOUT #
121+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
122+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
123+# more details. #
124+# #
125+# You should have received a copy of the GNU General Public License along #
126+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
127+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
128+###############################################################################
129+"""
130+The :mod:`lyrix` module provides the functionality for importing songs which are
131+exproted from Lyrix."""
132+
133+import logging
134+import re
135+
136+from openlp.core.common import translate
137+from openlp.plugins.songs.lib.importers.songimport import SongImport
138+
139+log = logging.getLogger(__name__)
140+
141+
142+class LyrixImport(SongImport):
143+ """
144+ Import songs exported from Lyrix
145+ """
146+
147+ def __init__(self, manager, **kwargs):
148+ """
149+ Initialise the class.
150+ """
151+ super(LyrixImport, self).__init__(manager, **kwargs)
152+
153+ def do_import(self):
154+ """
155+ Receive a single file or a list of files to import.
156+ """
157+ if not isinstance(self.import_source, list):
158+ return
159+ self.import_wizard.progress_bar.setMaximum(len(self.import_source))
160+ for filename in self.import_source:
161+ if self.stop_import_flag:
162+ return
163+ song_file = open(filename, 'rt', encoding='cp1251')
164+ self.do_import_file(song_file)
165+ song_file.close()
166+
167+ def do_import_file(self, file):
168+ """
169+ Process the Lyrix file - pass in a file-like object, not a file path.
170+ """
171+ self.set_defaults()
172+ # Setup variables
173+ line_number = 0
174+ song_title = 'Standard Song Title'
175+ ccli = '0'
176+ current_verse = ''
177+ verses = []
178+ author = ''
179+ copyright = ''
180+ try:
181+ # Read the file
182+ for line in file:
183+ line = line.strip()
184+ line_number += 1
185+ if line_number == 4:
186+ song_title = line
187+ if line_number < 7:
188+ continue
189+ # Detect and get CCLI number
190+ if line.lower().startswith('ccli'):
191+ ccli = re.findall('\d+', line)[0]
192+ try:
193+ # If the CCLI was found, we are near the end
194+ # Find author
195+ line = next(file).strip()
196+ author = line[line.find(':') + 2:]
197+ # Find copyright
198+ copyright = next(file).strip()
199+ except StopIteration:
200+ pass
201+ break
202+ if line == '':
203+ if current_verse != '':
204+ verses.append(current_verse)
205+ current_verse = ''
206+ else:
207+ if current_verse == '':
208+ current_verse += line
209+ else:
210+ current_verse += '\n' + line
211+ except Exception as e:
212+ self.log_error(translate('SongsPlugin.LyrixImport', 'File %s' % file.name),
213+ translate('SongsPlugin.LyrixImport', 'Error: %s') % e)
214+ return
215+ self.title = song_title
216+ self.parse_author(author)
217+ self.ccli_number = ccli
218+ self.add_copyright(copyright)
219+ for verse in verses:
220+ self.add_verse(verse, 'v')
221+ if not self.finish():
222+ self.log_error(file.name)
223
224=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
225--- openlp/plugins/songs/lib/importers/songimport.py 2015-09-08 19:13:59 +0000
226+++ openlp/plugins/songs/lib/importers/songimport.py 2015-12-20 19:34:43 +0000
227@@ -255,13 +255,13 @@
228 if author2:
229 self.add_author(author2)
230
231- def add_author(self, author):
232+ def add_author(self, author, type=None):
233 """
234 Add an author to the list
235 """
236- if author in self.authors:
237+ if (author, type) in self.authors:
238 return
239- self.authors.append(author)
240+ self.authors.append((author, type))
241
242 def add_media_file(self, filename, weight=0):
243 """
244@@ -360,13 +360,13 @@
245 song.comments = self.comments
246 song.theme_name = self.theme_name
247 song.ccli_number = self.ccli_number
248- for author_text in self.authors:
249+ for author_text, author_type in self.authors:
250 author = self.manager.get_object_filtered(Author, Author.display_name == author_text)
251 if not author:
252 author = Author.populate(display_name=author_text,
253 last_name=author_text.split(' ')[-1],
254 first_name=' '.join(author_text.split(' ')[:-1]))
255- song.add_author(author)
256+ song.add_author(author, author_type)
257 if self.song_book_name:
258 song_book = self.manager.get_object_filtered(Book, Book.name == self.song_book_name)
259 if song_book is None:
260
261=== added file 'openlp/plugins/songs/lib/importers/videopsalm.py'
262--- openlp/plugins/songs/lib/importers/videopsalm.py 1970-01-01 00:00:00 +0000
263+++ openlp/plugins/songs/lib/importers/videopsalm.py 2015-12-20 19:34:43 +0000
264@@ -0,0 +1,123 @@
265+# -*- coding: utf-8 -*-
266+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
267+
268+###############################################################################
269+# OpenLP - Open Source Lyrics Projection #
270+# --------------------------------------------------------------------------- #
271+# Copyright (c) 2008-2015 OpenLP Developers #
272+# --------------------------------------------------------------------------- #
273+# This program is free software; you can redistribute it and/or modify it #
274+# under the terms of the GNU General Public License as published by the Free #
275+# Software Foundation; version 2 of the License. #
276+# #
277+# This program is distributed in the hope that it will be useful, but WITHOUT #
278+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
279+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
280+# more details. #
281+# #
282+# You should have received a copy of the GNU General Public License along #
283+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
284+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
285+###############################################################################
286+"""
287+The :mod:`lyrix` module provides the functionality for importing songs which are
288+exproted from Lyrix."""
289+
290+import logging
291+import json
292+import os
293+
294+from openlp.core.common import translate
295+from openlp.plugins.songs.lib import VerseType
296+from openlp.plugins.songs.lib.importers.songimport import SongImport
297+from openlp.plugins.songs.lib.db import AuthorType
298+
299+log = logging.getLogger(__name__)
300+
301+
302+class VideoPsalmImport(SongImport):
303+ """
304+ Import songs exported from Lyrix
305+ """
306+
307+ def __init__(self, manager, **kwargs):
308+ """
309+ Initialise the class.
310+ """
311+ super(VideoPsalmImport, self).__init__(manager, **kwargs)
312+
313+ def do_import(self):
314+ """
315+ Process the VideoPsalm file - pass in a file-like object, not a file path.
316+ """
317+ self.set_defaults()
318+ # Open SongBook file
319+ song_file = open(self.import_source, 'rt', encoding='utf-8-sig')
320+ try:
321+ file_content = song_file.read()
322+ processed_content = ''
323+ inside_quotes = False
324+ # The VideoPsalm format is not valid json, it uses illegal line breaks and unquoted keys, this must be fixed
325+ file_content_it = iter(file_content)
326+ for c in file_content_it:
327+ if c == '"':
328+ inside_quotes = not inside_quotes
329+ # Detect invalid linebreak
330+ if c == '\n':
331+ if inside_quotes:
332+ processed_content += '\\n'
333+ # Put keys in quotes
334+ elif c.isalnum() and not inside_quotes:
335+ processed_content += '"' + c
336+ c = next(file_content_it)
337+ while c.isalnum():
338+ processed_content += c
339+ c = next(file_content_it)
340+ processed_content += '"' + c
341+ else:
342+ processed_content += c
343+ songbook = json.loads(processed_content.strip())
344+ # Get song array
345+ songs = songbook['Songs']
346+ self.import_wizard.progress_bar.setMaximum(len(songs))
347+ songbook_name = songbook['Text']
348+ media_folder = os.path.normpath(os.path.join(os.path.dirname(song_file.name), '..', 'Audio'))
349+ for song in songs:
350+ self.song_book_name = songbook_name
351+ if 'Text' in song:
352+ self.title = song['Text']
353+ composer = None
354+ author = None
355+ if 'Composer' in song:
356+ composer = song['Composer']
357+ if 'Author' in song:
358+ author = song['Author']
359+ if author and composer == author:
360+ self.add_author(author, AuthorType.WordsAndMusic)
361+ else:
362+ if author:
363+ self.add_author(author, AuthorType.Words)
364+ if composer:
365+ self.add_author(composer, AuthorType.Music)
366+ if 'Copyright' in song:
367+ self.add_copyright(song['Copyright'].replace('\n', ' ').strip())
368+ if 'CCLI' in song:
369+ self.ccli_number = song['CCLI']
370+ if 'Theme' in song:
371+ self.topics = song['Theme'].splitlines()
372+ if 'AudioFile' in song:
373+ self.add_media_file(os.path.join(media_folder, song['AudioFile']))
374+ if 'Memo1' in song:
375+ self.add_comment(song['Memo1'])
376+ if 'Memo2' in song:
377+ self.add_comment(song['Memo2'])
378+ if 'Memo3' in song:
379+ self.add_comment(song['Memo3'])
380+ for verse in song['Verses']:
381+ self.add_verse(verse['Text'], 'v')
382+ if not self.finish():
383+ self.log_error('Could not import %s' % self.title)
384+ except Exception as e:
385+ self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s' % file.name),
386+ translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e)
387+ song_file.close()
388
389=== added file 'tests/functional/openlp_plugins/songs/test_lyriximport.py'
390--- tests/functional/openlp_plugins/songs/test_lyriximport.py 1970-01-01 00:00:00 +0000
391+++ tests/functional/openlp_plugins/songs/test_lyriximport.py 2015-12-20 19:34:43 +0000
392@@ -0,0 +1,53 @@
393+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
394+
395+###############################################################################
396+# OpenLP - Open Source Lyrics Projection #
397+# --------------------------------------------------------------------------- #
398+# Copyright (c) 2008-2015 OpenLP Developers #
399+# --------------------------------------------------------------------------- #
400+# This program is free software; you can redistribute it and/or modify it #
401+# under the terms of the GNU General Public License as published by the Free #
402+# Software Foundation; version 2 of the License. #
403+# #
404+# This program is distributed in the hope that it will be useful, but WITHOUT #
405+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
406+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
407+# more details. #
408+# #
409+# You should have received a copy of the GNU General Public License along #
410+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
411+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
412+###############################################################################
413+"""
414+This module contains tests for the LyriX song importer.
415+"""
416+
417+import os
418+from unittest import TestCase
419+
420+from tests.helpers.songfileimport import SongImportTestHelper
421+from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
422+from openlp.core.common import Registry
423+from tests.functional import patch, MagicMock
424+
425+TEST_PATH = os.path.abspath(
426+ os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'lyrixsongs'))
427+
428+
429+class TestLyrixFileImport(SongImportTestHelper):
430+
431+ def __init__(self, *args, **kwargs):
432+ self.importer_class_name = 'LyrixImport'
433+ self.importer_module_name = 'lyrix'
434+ super(TestLyrixFileImport, self).__init__(*args, **kwargs)
435+
436+ def test_song_import(self):
437+ """
438+ Test that loading an LyriX file works correctly on various files
439+ """
440+ self.file_import([os.path.join(TEST_PATH, 'A06.TXT')],
441+ self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))
442+ self.file_import([os.path.join(TEST_PATH, 'A002.TXT')],
443+ self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace2.json')))
444+ self.file_import([os.path.join(TEST_PATH, 'AO05.TXT')],
445+ self.load_external_result_data(os.path.join(TEST_PATH, 'in die regterhand.json')))
446
447=== modified file 'tests/functional/openlp_plugins/songs/test_songbeamerimport.py'
448--- tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2015-01-18 13:39:21 +0000
449+++ tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2015-12-20 19:34:43 +0000
450@@ -26,27 +26,28 @@
451 import os
452 from unittest import TestCase
453
454+from tests.helpers.songfileimport import SongImportTestHelper
455 from tests.functional import MagicMock, patch
456 from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport
457-from openlp.plugins.songs.lib import VerseType
458 from openlp.core.common import Registry
459
460 TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
461 '..', '..', '..', 'resources', 'songbeamersongs'))
462-SONG_TEST_DATA = {
463- 'Lobsinget dem Herrn.sng': {
464- 'title': 'GL 1 - Lobsinget dem Herrn',
465- 'verses': [
466- ('1. Lobsinget dem Herrn,\no preiset Ihn gern!\nAnbetung und Lob Ihm gebühret.\n', 'v'),
467- ('2. Lobsingt Seiner Lieb´,\ndie einzig ihn trieb,\nzu sterben für unsere Sünden!\n', 'v'),
468- ('3. Lobsingt Seiner Macht!\nSein Werk ist vollbracht:\nEr sitzet zur Rechten des Vaters.\n', 'v'),
469- ('4. Lobsingt seiner Treu´,\ndie immerdar neu,\nbis Er uns zur Herrlichket führet!\n\n', 'v')
470- ],
471- 'song_book_name': 'Glaubenslieder I',
472- 'song_number': "1",
473- 'authors': ['Carl Brockhaus', 'Johann Jakob Vetter']
474- }
475-}
476+
477+
478+class TestSongBeamerFileImport(SongImportTestHelper):
479+
480+ def __init__(self, *args, **kwargs):
481+ self.importer_class_name = 'SongBeamerImport'
482+ self.importer_module_name = 'songbeamer'
483+ super(TestSongBeamerFileImport, self).__init__(*args, **kwargs)
484+
485+ def test_song_import(self):
486+ """
487+ Test that loading an OpenSong file works correctly on various files
488+ """
489+ self.file_import([os.path.join(TEST_PATH, 'Lobsinget dem Herrn.sng')],
490+ self.load_external_result_data(os.path.join(TEST_PATH, 'Lobsinget dem Herrn.json')))
491
492
493 class TestSongBeamerImport(TestCase):
494@@ -115,51 +116,6 @@
495 'do_import should return None when import_source is a list and stop_import_flag is True')
496 mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
497
498- def file_import_test(self):
499- """
500- Test the actual import of real song files and check that the imported data is correct.
501- """
502-
503- # GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
504- # and mocked out "author", "add_copyright", "add_verse", "finish" methods.
505- with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
506- for song_file in SONG_TEST_DATA:
507- mocked_manager = MagicMock()
508- mocked_import_wizard = MagicMock()
509- mocked_add_verse = MagicMock()
510- mocked_finish = MagicMock()
511- mocked_finish.return_value = True
512- importer = SongBeamerImport(mocked_manager, filenames=[])
513- importer.import_wizard = mocked_import_wizard
514- importer.stop_import_flag = False
515- importer.add_verse = mocked_add_verse
516- importer.finish = mocked_finish
517-
518- # WHEN: Importing each file
519- importer.import_source = [os.path.join(TEST_PATH, song_file)]
520- title = SONG_TEST_DATA[song_file]['title']
521- add_verse_calls = SONG_TEST_DATA[song_file]['verses']
522- song_book_name = SONG_TEST_DATA[song_file]['song_book_name']
523- song_number = SONG_TEST_DATA[song_file]['song_number']
524- song_authors = SONG_TEST_DATA[song_file]['authors']
525-
526- # THEN: do_import should return none, the song data should be as expected, and finish should have been
527- # called.
528- self.assertIsNone(importer.do_import(), 'do_import should return None when it has completed')
529- self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (song_file, title))
530- for verse_text, verse_tag in add_verse_calls:
531- mocked_add_verse.assert_any_call(verse_text, verse_tag)
532- if song_book_name:
533- self.assertEqual(importer.song_book_name, song_book_name,
534- 'song_book_name for %s should be "%s"' % (song_file, song_book_name))
535- if song_number:
536- self.assertEqual(importer.song_number, song_number,
537- 'song_number for %s should be %s' % (song_file, song_number))
538- if song_authors:
539- for author in importer.authors:
540- self.assertIn(author, song_authors)
541- mocked_finish.assert_called_with()
542-
543 def check_verse_marks_test(self):
544 """
545 Tests different lines to see if a verse mark is detected or not
546
547=== modified file 'tests/functional/openlp_plugins/songs/test_songselect.py'
548--- tests/functional/openlp_plugins/songs/test_songselect.py 2015-12-17 21:43:49 +0000
549+++ tests/functional/openlp_plugins/songs/test_songselect.py 2015-12-20 19:34:43 +0000
550@@ -28,6 +28,7 @@
551
552 from PyQt4 import QtGui
553
554+from tests.helpers.songfileimport import SongImportTestHelper
555 from openlp.core import Registry
556 from openlp.plugins.songs.forms.songselectform import SongSelectForm, SearchWorker
557 from openlp.plugins.songs.lib import Song
558@@ -37,6 +38,9 @@
559 from tests.functional import MagicMock, patch, call
560 from tests.helpers.testmixin import TestMixin
561
562+TEST_PATH = os.path.abspath(
563+ os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'songselect'))
564+
565
566 class TestSongSelectImport(TestCase, TestMixin):
567 """
568@@ -645,68 +649,21 @@
569 mocked_view_button.setEnabled.assert_called_with(True)
570
571
572-class TestSongSelectFileImport(TestCase, TestMixin):
573- """
574- Test SongSelect file import
575- """
576- def setUp(self):
577- """
578- Initial setups
579- """
580- Registry.create()
581- test_song_name = 'TestSong'
582- self.file_name = os.path.join('tests', 'resources', 'songselect', test_song_name)
583- self.title = 'Test Song'
584- self.ccli_number = '0000000'
585- self.authors = ['Author One', 'Author Two']
586- self.topics = ['Adoration', 'Praise']
587-
588- def songselect_import_bin_file_test(self):
589- """
590- Verify import SongSelect BIN file parses file properly
591- """
592- # GIVEN: Text file to import and mocks
593- copyright_bin = '2011 OpenLP Programmer One (Admin. by OpenLP One) | ' \
594- 'Openlp Programmer Two (Admin. by OpenLP Two)'
595- verses_bin = [
596- ['v1', 'Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One', None],
597- ['v2', 'Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two', None]
598- ]
599- song_import = CCLIFileImport(manager=None, filename=['{}.bin'.format(self.file_name)])
600-
601- with patch.object(song_import, 'import_wizard'), patch.object(song_import, 'finish'):
602- # WHEN: We call the song importer
603- song_import.do_import()
604- # THEN: Song values should be equal to test values in setUp
605- self.assertEquals(song_import.title, self.title, 'Song title should match')
606- self.assertEquals(song_import.ccli_number, self.ccli_number, 'CCLI Song Number should match')
607- self.assertEquals(song_import.authors, self.authors, 'Author(s) should match')
608- self.assertEquals(song_import.copyright, copyright_bin, 'Copyright should match')
609- self.assertEquals(song_import.topics, self.topics, 'Theme(s) should match')
610- self.assertEquals(song_import.verses, verses_bin, 'Verses should match with test verses')
611-
612- def songselect_import_text_file_test(self):
613- """
614- Verify import SongSelect TEXT file parses file properly
615- """
616- # GIVEN: Text file to import and mocks
617- copyright_txt = '© 2011 OpenLP Programmer One (Admin. by OpenLP One)'
618- verses_txt = [
619- ['v1', 'Line One Verse One\r\nLine Two Verse One\r\nLine Three Verse One\r\nLine Four Verse One', None],
620- ['v2', 'Line One Verse Two\r\nLine Two Verse Two\r\nLine Three Verse Two\r\nLine Four Verse Two', None]
621- ]
622- song_import = CCLIFileImport(manager=None, filename=['{}.txt'.format(self.file_name)])
623-
624- with patch.object(song_import, 'import_wizard'), patch.object(song_import, 'finish'):
625- # WHEN: We call the song importer
626- song_import.do_import()
627-
628- # THEN: Song values should be equal to test values in setUp
629- self.assertEquals(song_import.title, self.title, 'Song title should match')
630- self.assertEquals(song_import.ccli_number, self.ccli_number, 'CCLI Song Number should match')
631- self.assertEquals(song_import.authors, self.authors, 'Author(s) should match')
632- self.assertEquals(song_import.copyright, copyright_txt, 'Copyright should match')
633- self.assertEquals(song_import.verses, verses_txt, 'Verses should match with test verses')
634+class TestSongSelectFileImport(SongImportTestHelper):
635+
636+ def __init__(self, *args, **kwargs):
637+ self.importer_class_name = 'CCLIFileImport'
638+ self.importer_module_name = 'cclifile'
639+ super(TestSongSelectFileImport, self).__init__(*args, **kwargs)
640+
641+ def test_song_import(self):
642+ """
643+ Test that loading an OpenSong file works correctly on various files
644+ """
645+ self.file_import([os.path.join(TEST_PATH, 'TestSong.bin')],
646+ self.load_external_result_data(os.path.join(TEST_PATH, 'TestSong-bin.json')))
647+ self.file_import([os.path.join(TEST_PATH, 'TestSong.txt')],
648+ self.load_external_result_data(os.path.join(TEST_PATH, 'TestSong-txt.json')))
649
650
651 class TestSearchWorker(TestCase, TestMixin):
652
653=== added file 'tests/functional/openlp_plugins/songs/test_videopsalm.py'
654--- tests/functional/openlp_plugins/songs/test_videopsalm.py 1970-01-01 00:00:00 +0000
655+++ tests/functional/openlp_plugins/songs/test_videopsalm.py 2015-12-20 19:34:43 +0000
656@@ -0,0 +1,49 @@
657+# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
658+
659+###############################################################################
660+# OpenLP - Open Source Lyrics Projection #
661+# --------------------------------------------------------------------------- #
662+# Copyright (c) 2008-2015 OpenLP Developers #
663+# --------------------------------------------------------------------------- #
664+# This program is free software; you can redistribute it and/or modify it #
665+# under the terms of the GNU General Public License as published by the Free #
666+# Software Foundation; version 2 of the License. #
667+# #
668+# This program is distributed in the hope that it will be useful, but WITHOUT #
669+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
670+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
671+# more details. #
672+# #
673+# You should have received a copy of the GNU General Public License along #
674+# with this program; if not, write to the Free Software Foundation, Inc., 59 #
675+# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
676+###############################################################################
677+"""
678+This module contains tests for the VideoPsalm song importer.
679+"""
680+
681+import os
682+from unittest import TestCase
683+
684+from tests.helpers.songfileimport import SongImportTestHelper
685+from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
686+from openlp.core.common import Registry
687+from tests.functional import patch, MagicMock
688+
689+TEST_PATH = os.path.abspath(
690+ os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'videopsalmsongs'))
691+
692+
693+class TestVideoPsalmFileImport(SongImportTestHelper):
694+
695+ def __init__(self, *args, **kwargs):
696+ self.importer_class_name = 'VideoPsalmImport'
697+ self.importer_module_name = 'videopsalm'
698+ super(TestVideoPsalmFileImport, self).__init__(*args, **kwargs)
699+
700+ def test_song_import(self):
701+ """
702+ Test that loading an VideoPsalm file works correctly on various files
703+ """
704+ self.file_import(os.path.join(TEST_PATH, 'videopsalm-as-safe-a-stronghold.json'),
705+ self.load_external_result_data(os.path.join(TEST_PATH, 'as-safe-a-stronghold.json')))
706
707=== modified file 'tests/helpers/songfileimport.py'
708--- tests/helpers/songfileimport.py 2015-01-18 13:39:21 +0000
709+++ tests/helpers/songfileimport.py 2015-12-20 19:34:43 +0000
710@@ -124,7 +124,10 @@
711
712 self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title))
713 for author in author_calls:
714- self.mocked_add_author.assert_any_call(author)
715+ if isinstance(author, str):
716+ self.mocked_add_author.assert_any_call(author)
717+ else:
718+ self.mocked_add_author.assert_any_call(*author)
719 if song_copyright:
720 self.mocked_add_copyright.assert_called_with(song_copyright)
721 if ccli_number:
722
723=== added directory 'tests/resources/lyrixsongs'
724=== added file 'tests/resources/lyrixsongs/A002.TXT'
725--- tests/resources/lyrixsongs/A002.TXT 1970-01-01 00:00:00 +0000
726+++ tests/resources/lyrixsongs/A002.TXT 2015-12-20 19:34:43 +0000
727@@ -0,0 +1,34 @@
728+
729+-------------
730+A002
731+AMAZING GRACE
732+-------------
733+
734+1. AMAZING GRACE! HOW SWEET THE SOUND
735+THAT SAVED A WRETCH LIKE ME;
736+I ONCE WAS LOST, BUT NOW AM FOUND;
737+WAS BLIND, BUT NOW I SEE.
738+
739+2. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR
740+AND GRACE MY FEARS RELIEVED;
741+HOW PRECIOUS DID THAT GRACE APPEAR,
742+THE HOUR I FIRST BELIEVED!
743+
744+3. THROUGH MANY DANGERS, TRIALS AND SNARES
745+I HAVE ALREADY COME;
746+'TIS GRACE THAT BROUGHT ME SAFE THUS FAR
747+AND GRACE WILL LEAD ME HOME.
748+
749+4. THE LORD HAS PROMISED GOOD TO ME,
750+HIS WORD MY HOPE SECURES;
751+HE WILL MY SHIELD AND FORTRESS BE
752+AS LONG AS LIFE ENDURES.
753+
754+5. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS
755+BRIGHT SHINING AS THE SUN,
756+WE'VE NO LESS DAYS TO SING GOD'S PRAISE
757+THAN WHEN WE'D FIRST BEGUN.
758+
759+CCLI no.: 22025
760+Words/Music: Edwin Excell, John Newton, John P. Rees
761+Public Domain
762
763=== added file 'tests/resources/lyrixsongs/A06.TXT'
764--- tests/resources/lyrixsongs/A06.TXT 1970-01-01 00:00:00 +0000
765+++ tests/resources/lyrixsongs/A06.TXT 2015-12-20 19:34:43 +0000
766@@ -0,0 +1,31 @@
767+
768+----------------------------------
769+A06
770+AMAZING GRACE, HOW SWEET THE SOUND
771+----------------------------------
772+
773+1. AMAZING GRACE, HOW SWEET THE SOUND
774+THAT SAVED A WRETCH LIKE ME
775+I ONCE WAS LOST, BUT NOW I'M FOUND
776+WAS BLIND, BUT NOW I SEE
777+
778+2. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR
779+AND GRACE MY FEARS RELIEVED
780+HOW PRECIOUS DID THAT GRACE APPEAR
781+THE HOUR I FIRST BELIEVED
782+
783+3. THROUGH MANY DANGERS, TOILS AND SNARES
784+I HAVE ALREADY COME, 'TWAS GRACE
785+THAT BROUGHT ME SAFE THUS FAR
786+AND GRACE WILL LEAD ME HOME
787+
788+4. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS
789+BRIGHT SHINING AS THE SUN
790+WE'VE NO LESS DAYS TO SING GOD'S PRAISE
791+THAN WHEN WE'VE FIRST BEGUN
792+
793+5. PRAISE GOD, PRAISE GOD
794+PRAISE GOD, PRAISE GOD
795+PRAISE GOD, PRAISE GOD
796+PRAISE GOD..
797+
798
799=== added file 'tests/resources/lyrixsongs/AO05.TXT'
800--- tests/resources/lyrixsongs/AO05.TXT 1970-01-01 00:00:00 +0000
801+++ tests/resources/lyrixsongs/AO05.TXT 2015-12-20 19:34:43 +0000
802@@ -0,0 +1,48 @@
803+
804+--------------------------------
805+AO05
806+IN DIE REGTERHAND VAN HOM WAT IN
807+--------------------------------
808+
809+1. IN DIE REGTERHAND VAN HOM
810+WAT IN MAJESTEIT REGEER
811+Lê DIE BOEKROL VAN VERLOSSING
812+SEWEMAAL VERSEëL
813+EN NIEMAND KON GEVIND WORD
814+OM SY SEëLS OOP TE BREEK
815+TOT DIE LAM VAN GOD NA VORE KOM
816+OM DIE BOEKROL SELF TE NEEM
817+DIE VIER-EN-TWINTIG OUDERLINGE
818+VAL TOE VOOR HOM NEER
819+SAAM MET AL DIE ENG'LE
820+IN DIE GANSE HEMELLEëR,
821+EN ELKE WESE WAT ASEM HET
822+OP DIE AARDE, IN DIE SEE, EN OOR DIE
823+LENGTE EN DIE BREEDTE
824+VAN DIE SKEPPING BRING HOM EER
825+
826+2. HERE U ALLEEN IS WAARDIG
827+OM DIE LEWENSBOEK TE NEEM
828+EN U ALLEEN IS MAGTIG
829+OM SY SEëLS OOP TE BREEK,
830+WANT U'T VIR ONS GESTERWE,
831+MET U BLOED HET U BETAAL
832+OM ONS LOS TE KOOP
833+UIT ELKE STAM EN NASIE,VOLK EN TAAL
834+
835+AL DIE LOF EN DIE KRAG
836+EN DIE EER
837+EN DIE HEERLIKHEID
838+EN RYKDON EN STERKTE
839+AAN U ALLEEN O HEER
840+AL DIE LOF EN DIE KRAG
841+EN DIE EER
842+EN WYSHEID AAN DIE LAM
843+OP DIE TROON
844+WAT NOU EN TOT IN
845+EWIGHEID REGEER
846+NOU EN TOT IN EWIGHEID
847+REGEER
848+DIE LAM WAT TOT IN
849+EWIGHEID REGEER
850+
851
852=== added file 'tests/resources/lyrixsongs/Amazing Grace.json'
853--- tests/resources/lyrixsongs/Amazing Grace.json 1970-01-01 00:00:00 +0000
854+++ tests/resources/lyrixsongs/Amazing Grace.json 2015-12-20 19:34:43 +0000
855@@ -0,0 +1,26 @@
856+{
857+ "title": "AMAZING GRACE, HOW SWEET THE SOUND",
858+ "verse_order_list": [],
859+ "verses": [
860+ [
861+ "1. AMAZING GRACE, HOW SWEET THE SOUND\nTHAT SAVED A WRETCH LIKE ME\nI ONCE WAS LOST, BUT NOW I'M FOUND\nWAS BLIND, BUT NOW I SEE",
862+ "v"
863+ ],
864+ [
865+ "2. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR\nAND GRACE MY FEARS RELIEVED\nHOW PRECIOUS DID THAT GRACE APPEAR\nTHE HOUR I FIRST BELIEVED",
866+ "v"
867+ ],
868+ [
869+ "3. THROUGH MANY DANGERS, TOILS AND SNARES\nI HAVE ALREADY COME, 'TWAS GRACE\nTHAT BROUGHT ME SAFE THUS FAR\nAND GRACE WILL LEAD ME HOME",
870+ "v"
871+ ],
872+ [
873+ "4. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS\nBRIGHT SHINING AS THE SUN\nWE'VE NO LESS DAYS TO SING GOD'S PRAISE\nTHAN WHEN WE'VE FIRST BEGUN",
874+ "v"
875+ ],
876+ [
877+ "5. PRAISE GOD, PRAISE GOD\nPRAISE GOD, PRAISE GOD\nPRAISE GOD, PRAISE GOD\nPRAISE GOD..",
878+ "v"
879+ ]
880+ ]
881+}
882
883=== added file 'tests/resources/lyrixsongs/Amazing Grace2.json'
884--- tests/resources/lyrixsongs/Amazing Grace2.json 1970-01-01 00:00:00 +0000
885+++ tests/resources/lyrixsongs/Amazing Grace2.json 2015-12-20 19:34:43 +0000
886@@ -0,0 +1,33 @@
887+{
888+ "authors": [
889+ "John Newton",
890+ "Edwin Excell",
891+ "John P. Rees"
892+ ],
893+ "ccli_number": "22025",
894+ "copyright": "Public Domain",
895+ "title": "AMAZING GRACE",
896+ "verse_order_list": [],
897+ "verses": [
898+ [
899+ "1. AMAZING GRACE! HOW SWEET THE SOUND\nTHAT SAVED A WRETCH LIKE ME;\nI ONCE WAS LOST, BUT NOW AM FOUND;\nWAS BLIND, BUT NOW I SEE.",
900+ "v"
901+ ],
902+ [
903+ "2. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR\nAND GRACE MY FEARS RELIEVED;\nHOW PRECIOUS DID THAT GRACE APPEAR,\nTHE HOUR I FIRST BELIEVED!",
904+ "v"
905+ ],
906+ [
907+ "3. THROUGH MANY DANGERS, TRIALS AND SNARES\nI HAVE ALREADY COME;\n'TIS GRACE THAT BROUGHT ME SAFE THUS FAR\nAND GRACE WILL LEAD ME HOME.",
908+ "v"
909+ ],
910+ [
911+ "4. THE LORD HAS PROMISED GOOD TO ME,\nHIS WORD MY HOPE SECURES;\nHE WILL MY SHIELD AND FORTRESS BE\nAS LONG AS LIFE ENDURES.",
912+ "v"
913+ ],
914+ [
915+ "5. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS\nBRIGHT SHINING AS THE SUN,\nWE'VE NO LESS DAYS TO SING GOD'S PRAISE\nTHAN WHEN WE'D FIRST BEGUN.",
916+ "v"
917+ ]
918+ ]
919+}
920
921=== added file 'tests/resources/lyrixsongs/in die regterhand.json'
922--- tests/resources/lyrixsongs/in die regterhand.json 1970-01-01 00:00:00 +0000
923+++ tests/resources/lyrixsongs/in die regterhand.json 2015-12-20 19:34:43 +0000
924@@ -0,0 +1,18 @@
925+{
926+ "title": "IN DIE REGTERHAND VAN HOM WAT IN",
927+ "verse_order_list": [],
928+ "verses": [
929+ [
930+ "1. IN DIE REGTERHAND VAN HOM\nWAT IN MAJESTEIT REGEER\nLк DIE BOEKROL VAN VERLOSSING\nSEWEMAAL VERSEлL\nEN NIEMAND KON GEVIND WORD\nOM SY SEлLS OOP TE BREEK\nTOT DIE LAM VAN GOD NA VORE KOM\nOM DIE BOEKROL SELF TE NEEM\nDIE VIER-EN-TWINTIG OUDERLINGE\nVAL TOE VOOR HOM NEER\nSAAM MET AL DIE ENG'LE\nIN DIE GANSE HEMELLEлR,\nEN ELKE WESE WAT ASEM HET\nOP DIE AARDE, IN DIE SEE, EN OOR DIE\nLENGTE EN DIE BREEDTE\nVAN DIE SKEPPING BRING HOM EER",
931+ "v"
932+ ],
933+ [
934+ "2. HERE U ALLEEN IS WAARDIG\nOM DIE LEWENSBOEK TE NEEM\nEN U ALLEEN IS MAGTIG\nOM SY SEлLS OOP TE BREEK,\nWANT U'T VIR ONS GESTERWE,\nMET U BLOED HET U BETAAL\nOM ONS LOS TE KOOP\nUIT ELKE STAM EN NASIE,VOLK EN TAAL",
935+ "v"
936+ ],
937+ [
938+ "AL DIE LOF EN DIE KRAG\nEN DIE EER\nEN DIE HEERLIKHEID\nEN RYKDON EN STERKTE\nAAN U ALLEEN O HEER\nAL DIE LOF EN DIE KRAG\nEN DIE EER\nEN WYSHEID AAN DIE LAM\nOP DIE TROON\nWAT NOU EN TOT IN\nEWIGHEID REGEER\nNOU EN TOT IN EWIGHEID\nREGEER\nDIE LAM WAT TOT IN\nEWIGHEID REGEER",
939+ "v"
940+ ]
941+ ]
942+}
943
944=== added file 'tests/resources/songbeamersongs/Lobsinget dem Herrn.json'
945--- tests/resources/songbeamersongs/Lobsinget dem Herrn.json 1970-01-01 00:00:00 +0000
946+++ tests/resources/songbeamersongs/Lobsinget dem Herrn.json 2015-12-20 19:34:43 +0000
947@@ -0,0 +1,12 @@
948+{
949+ "title": "GL 1 - Lobsinget dem Herrn",
950+ "verses": [
951+ ["1. Lobsinget dem Herrn,\no preiset Ihn gern!\nAnbetung und Lob Ihm gebühret.\n", "v"],
952+ ["2. Lobsingt Seiner Lieb´,\ndie einzig ihn trieb,\nzu sterben für unsere Sünden!\n", "v"],
953+ ["3. Lobsingt Seiner Macht!\nSein Werk ist vollbracht:\nEr sitzet zur Rechten des Vaters.\n", "v"],
954+ ["4. Lobsingt seiner Treu´,\ndie immerdar neu,\nbis Er uns zur Herrlichket führet!\n\n", "v"]
955+ ],
956+ "song_book_name": "Glaubenslieder I",
957+ "song_number": "1",
958+ "authors": ["Carl Brockhaus", "Johann Jakob Vetter"]
959+}
960
961=== added file 'tests/resources/songselect/TestSong-bin.json'
962--- tests/resources/songselect/TestSong-bin.json 1970-01-01 00:00:00 +0000
963+++ tests/resources/songselect/TestSong-bin.json 2015-12-20 19:34:43 +0000
964@@ -0,0 +1,25 @@
965+{
966+ "authors": [
967+ "Author One",
968+ "Author Two"
969+ ],
970+ "ccli_number": "0000000",
971+ "song_number": 0,
972+ "title": "Test Song",
973+ "topics": [
974+ "Adoration",
975+ "Praise"
976+ ],
977+ "copyright": "2011 OpenLP Programmer One (Admin. by OpenLP One) | Openlp Programmer Two (Admin. by OpenLP Two)",
978+ "verse_order_list": [],
979+ "verses": [
980+ [
981+ "Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One\n",
982+ "v"
983+ ],
984+ [
985+ "Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two\n",
986+ "v"
987+ ]
988+ ]
989+}
990
991=== added file 'tests/resources/songselect/TestSong-txt.json'
992--- tests/resources/songselect/TestSong-txt.json 1970-01-01 00:00:00 +0000
993+++ tests/resources/songselect/TestSong-txt.json 2015-12-20 19:34:43 +0000
994@@ -0,0 +1,21 @@
995+{
996+ "authors": [
997+ "Author One",
998+ "Author Two"
999+ ],
1000+ "ccli_number": "0000000",
1001+ "song_number": 0,
1002+ "title": "Test Song",
1003+ "copyright": "© 2011 OpenLP Programmer One (Admin. by OpenLP One)",
1004+ "verse_order_list": [],
1005+ "verses": [
1006+ [
1007+ "Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One\n",
1008+ "v"
1009+ ],
1010+ [
1011+ "Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two\n",
1012+ "v"
1013+ ]
1014+ ]
1015+}
1016
1017=== added directory 'tests/resources/videopsalmsongs'
1018=== added file 'tests/resources/videopsalmsongs/as-safe-a-stronghold.json'
1019--- tests/resources/videopsalmsongs/as-safe-a-stronghold.json 1970-01-01 00:00:00 +0000
1020+++ tests/resources/videopsalmsongs/as-safe-a-stronghold.json 2015-12-20 19:34:43 +0000
1021@@ -0,0 +1,35 @@
1022+{
1023+ "authors": [
1024+ ["Martin Luther", "words"],
1025+ ["Unknown", "music"]
1026+ ],
1027+ "ccli_number": "12345",
1028+ "comments": "This is\nthe first comment\nThis is\nthe second comment\nThis is\nthe third comment\n",
1029+ "copyright": "Public Domain",
1030+ "song_book_name": "SongBook1",
1031+ "song_number": 0,
1032+ "title": "A Safe Stronghold Our God is Still",
1033+ "topics": [
1034+ "tema1",
1035+ "tema2"
1036+ ],
1037+ "verse_order_list": [],
1038+ "verses": [
1039+ [
1040+ "As safe a stronghold our God is still,\nA trusty shield and weapon;\nHe’ll help us clear from all the ill\nThat hath us now o’ertaken.\nThe ancient prince of hell\nHath risen with purpose fell;\nStrong mail of craft and power\nHe weareth in this hour;\nOn earth is not His fellow.",
1041+ "v"
1042+ ],
1043+ [
1044+ "With force of arms we nothing can,\nFull soon were we down-ridden;\nBut for us fights the proper Man,\nWhom God Himself hath bidden.\nAsk ye: Who is this same?\nChrist Jesus is His name,\nThe Lord Sabaoth’s Son;\nHe, and no other one,\nShall conquer in the battle.",
1045+ "v"
1046+ ],
1047+ [
1048+ "And were this world all devils o’er,\nAnd watching to devour us,\nWe lay it not to heart so sore;\nNot they can overpower us.\nAnd let the prince of ill\nLook grim as e’er he will,\nHe harms us not a whit;\nFor why? his doom is writ;\nA word shall quickly slay him.",
1049+ "v"
1050+ ],
1051+ [
1052+ "God’s word, for all their craft and force,\nOne moment will not linger,\nBut, spite of hell, shall have its course;\n’Tis written by His finger.\nAnd though they take our life,\nGoods, honour, children, wife,\nYet is their profit small:\nThese things shall vanish all;\nThe city of God remaineth.",
1053+ "v"
1054+ ]
1055+ ]
1056+}
1057
1058=== added file 'tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json'
1059--- tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json 1970-01-01 00:00:00 +0000
1060+++ tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json 2015-12-20 19:34:43 +0000
1061@@ -0,0 +1,47 @@
1062+{Abbreviation:"SB1",Copyright:"Public domain",Songs:[{ID:3,Composer:"Unknown",Author:"Martin Luther",Copyright:"Public
1063+Domain",Theme:"tema1
1064+tema2",CCLI:"12345",Alias:"A safe stronghold",Memo1:"This is
1065+the first comment
1066+",Memo2:"This is
1067+the second comment
1068+",Memo3:"This is
1069+the third comment
1070+",Reference:"reference",Guid:"jtCkrJdPIUOmECjaQylg/g",Verses:[{
1071+Text:"As safe a stronghold our God is still,
1072+A trusty shield and weapon;
1073+He’ll help us clear from all the ill
1074+That hath us now o’ertaken.
1075+The ancient prince of hell
1076+Hath risen with purpose fell;
1077+Strong mail of craft and power
1078+He weareth in this hour;
1079+On earth is not His fellow."},{ID:2,
1080+Text:"With force of arms we nothing can,
1081+Full soon were we down-ridden;
1082+But for us fights the proper Man,
1083+Whom God Himself hath bidden.
1084+Ask ye: Who is this same?
1085+Christ Jesus is His name,
1086+The Lord Sabaoth’s Son;
1087+He, and no other one,
1088+Shall conquer in the battle."},{ID:3,
1089+Text:"And were this world all devils o’er,
1090+And watching to devour us,
1091+We lay it not to heart so sore;
1092+Not they can overpower us.
1093+And let the prince of ill
1094+Look grim as e’er he will,
1095+He harms us not a whit;
1096+For why? his doom is writ;
1097+A word shall quickly slay him."},{ID:4,
1098+Text:"God’s word, for all their craft and force,
1099+One moment will not linger,
1100+But, spite of hell, shall have its course;
1101+’Tis written by His finger.
1102+And though they take our life,
1103+Goods, honour, children, wife,
1104+Yet is their profit small:
1105+These things shall vanish all;
1106+The city of God remaineth."}],AudioFile:"282.mp3",IsAudioFileEnabled:1,
1107+Text:"A Safe Stronghold Our God is Still"}],Guid:"khiHU2blX0Kb41dGdbDLhA",VersionDate:"20121012000000",
1108+Text:"SongBook1"}