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
=== modified file 'openlp/plugins/songs/lib/importer.py'
--- openlp/plugins/songs/lib/importer.py 2015-08-26 07:26:19 +0000
+++ openlp/plugins/songs/lib/importer.py 2015-12-20 19:34:43 +0000
@@ -46,6 +46,8 @@
46from .importers.worshipassistant import WorshipAssistantImport46from .importers.worshipassistant import WorshipAssistantImport
47from .importers.powerpraise import PowerPraiseImport47from .importers.powerpraise import PowerPraiseImport
48from .importers.presentationmanager import PresentationManagerImport48from .importers.presentationmanager import PresentationManagerImport
49from .importers.lyrix import LyrixImport
50from .importers.videopsalm import VideoPsalmImport
4951
50log = logging.getLogger(__name__)52log = logging.getLogger(__name__)
5153
@@ -166,6 +168,8 @@
166 WorshipAssistant = 21168 WorshipAssistant = 21
167 WorshipCenterPro = 22169 WorshipCenterPro = 22
168 ZionWorx = 23170 ZionWorx = 23
171 Lyrix = 24
172 VideoPsalm = 25
169173
170 # Set optional attribute defaults174 # Set optional attribute defaults
171 __defaults__ = {175 __defaults__ = {
@@ -244,6 +248,13 @@
244 'prefix': 'foilPresenter',248 'prefix': 'foilPresenter',
245 'filter': '%s (*.foil)' % translate('SongsPlugin.ImportWizardForm', 'Foilpresenter Song Files')249 'filter': '%s (*.foil)' % translate('SongsPlugin.ImportWizardForm', 'Foilpresenter Song Files')
246 },250 },
251 Lyrix: {
252 'class': LyrixImport,
253 'name': 'LyriX',
254 'prefix': 'lyrix',
255 'filter': '%s (*.txt)' % translate('SongsPlugin.ImportWizardForm', 'LyriX Files'),
256 'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'LyriX (Exported TXT-files)')
257 },
247 MediaShout: {258 MediaShout: {
248 'name': 'MediaShout',259 'name': 'MediaShout',
249 'prefix': 'mediaShout',260 'prefix': 'mediaShout',
@@ -324,6 +335,16 @@
324 'prefix': 'sundayPlus',335 'prefix': 'sundayPlus',
325 'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')336 'filter': '%s (*.ptf)' % translate('SongsPlugin.ImportWizardForm', 'SundayPlus Song Files')
326 },337 },
338 VideoPsalm: {
339 'class': VideoPsalmImport,
340 'name': 'VideoPsalm',
341 'prefix': 'videopsalm',
342 'selectMode': SongFormatSelect.SingleFile,
343 'filter': '%s (*.json)' % translate('SongsPlugin.ImportWizardForm', 'VideoPsalm Files'),
344 'comboBoxText': translate('SongsPlugin.ImportWizardForm', 'VideoPsalm'),
345 'descriptionText': translate('SongsPlugin.ImportWizardForm', 'The VideoPsalm songbooks are normally located'
346 ' in %s') % 'C:\\Users\\Public\\Documents\\VideoPsalm\\SongBooks\\'
347 },
327 WordsOfWorship: {348 WordsOfWorship: {
328 'class': WordsOfWorshipImport,349 'class': WordsOfWorshipImport,
329 'name': 'Words of Worship',350 'name': 'Words of Worship',
@@ -393,7 +414,9 @@
393 SongFormat.WordsOfWorship,414 SongFormat.WordsOfWorship,
394 SongFormat.WorshipAssistant,415 SongFormat.WorshipAssistant,
395 SongFormat.WorshipCenterPro,416 SongFormat.WorshipCenterPro,
396 SongFormat.ZionWorx417 SongFormat.ZionWorx,
418 SongFormat.Lyrix,
419 SongFormat.VideoPsalm
397 ]420 ]
398421
399 @staticmethod422 @staticmethod
400423
=== modified file 'openlp/plugins/songs/lib/importers/cclifile.py'
--- openlp/plugins/songs/lib/importers/cclifile.py 2015-01-18 13:39:21 +0000
+++ openlp/plugins/songs/lib/importers/cclifile.py 2015-12-20 19:34:43 +0000
@@ -48,7 +48,7 @@
48 :param manager: The song manager for the running OpenLP installation.48 :param manager: The song manager for the running OpenLP installation.
49 :param kwargs: The files to be imported.49 :param kwargs: The files to be imported.
50 """50 """
51 SongImport.__init__(self, manager, **kwargs)51 super(CCLIFileImport, self).__init__(manager, **kwargs)
5252
53 def do_import(self):53 def do_import(self):
54 """54 """
@@ -161,7 +161,7 @@
161 elif line.startswith('Author='):161 elif line.startswith('Author='):
162 song_author = line[7:].strip()162 song_author = line[7:].strip()
163 elif line.startswith('Copyright='):163 elif line.startswith('Copyright='):
164 self.copyright = line[10:].strip()164 self.add_copyright(line[10:].strip())
165 elif line.startswith('Themes='):165 elif line.startswith('Themes='):
166 song_topics = line[7:].strip().replace(' | ', '/t')166 song_topics = line[7:].strip().replace(' | ', '/t')
167 elif line.startswith('Fields='):167 elif line.startswith('Fields='):
@@ -318,14 +318,14 @@
318 if line_number == 2:318 if line_number == 2:
319 line_number += 1319 line_number += 1
320 if clean_line.startswith('©'):320 if clean_line.startswith('©'):
321 self.copyright = clean_line321 self.add_copyright(clean_line)
322 else:322 else:
323 song_author = clean_line323 song_author = clean_line
324 # n=3, authors324 # n=3, authors
325 elif line_number == 3:325 elif line_number == 3:
326 line_number += 1326 line_number += 1
327 if song_author:327 if song_author:
328 self.copyright = clean_line328 self.add_copyright(clean_line)
329 else:329 else:
330 song_author = clean_line330 song_author = clean_line
331 # line_number=4, comments lines before last line331 # line_number=4, comments lines before last line
332332
=== added file 'openlp/plugins/songs/lib/importers/lyrix.py'
--- openlp/plugins/songs/lib/importers/lyrix.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/songs/lib/importers/lyrix.py 2015-12-20 19:34:43 +0000
@@ -0,0 +1,115 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3
4###############################################################################
5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #
7# Copyright (c) 2008-2015 OpenLP Developers #
8# --------------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #
10# under the terms of the GNU General Public License as published by the Free #
11# Software Foundation; version 2 of the License. #
12# #
13# This program is distributed in the hope that it will be useful, but WITHOUT #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
16# more details. #
17# #
18# You should have received a copy of the GNU General Public License along #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21###############################################################################
22"""
23The :mod:`lyrix` module provides the functionality for importing songs which are
24exproted from Lyrix."""
25
26import logging
27import re
28
29from openlp.core.common import translate
30from openlp.plugins.songs.lib.importers.songimport import SongImport
31
32log = logging.getLogger(__name__)
33
34
35class LyrixImport(SongImport):
36 """
37 Import songs exported from Lyrix
38 """
39
40 def __init__(self, manager, **kwargs):
41 """
42 Initialise the class.
43 """
44 super(LyrixImport, self).__init__(manager, **kwargs)
45
46 def do_import(self):
47 """
48 Receive a single file or a list of files to import.
49 """
50 if not isinstance(self.import_source, list):
51 return
52 self.import_wizard.progress_bar.setMaximum(len(self.import_source))
53 for filename in self.import_source:
54 if self.stop_import_flag:
55 return
56 song_file = open(filename, 'rt', encoding='cp1251')
57 self.do_import_file(song_file)
58 song_file.close()
59
60 def do_import_file(self, file):
61 """
62 Process the Lyrix file - pass in a file-like object, not a file path.
63 """
64 self.set_defaults()
65 # Setup variables
66 line_number = 0
67 song_title = 'Standard Song Title'
68 ccli = '0'
69 current_verse = ''
70 verses = []
71 author = ''
72 copyright = ''
73 try:
74 # Read the file
75 for line in file:
76 line = line.strip()
77 line_number += 1
78 if line_number == 4:
79 song_title = line
80 if line_number < 7:
81 continue
82 # Detect and get CCLI number
83 if line.lower().startswith('ccli'):
84 ccli = re.findall('\d+', line)[0]
85 try:
86 # If the CCLI was found, we are near the end
87 # Find author
88 line = next(file).strip()
89 author = line[line.find(':') + 2:]
90 # Find copyright
91 copyright = next(file).strip()
92 except StopIteration:
93 pass
94 break
95 if line == '':
96 if current_verse != '':
97 verses.append(current_verse)
98 current_verse = ''
99 else:
100 if current_verse == '':
101 current_verse += line
102 else:
103 current_verse += '\n' + line
104 except Exception as e:
105 self.log_error(translate('SongsPlugin.LyrixImport', 'File %s' % file.name),
106 translate('SongsPlugin.LyrixImport', 'Error: %s') % e)
107 return
108 self.title = song_title
109 self.parse_author(author)
110 self.ccli_number = ccli
111 self.add_copyright(copyright)
112 for verse in verses:
113 self.add_verse(verse, 'v')
114 if not self.finish():
115 self.log_error(file.name)
0116
=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
--- openlp/plugins/songs/lib/importers/songimport.py 2015-09-08 19:13:59 +0000
+++ openlp/plugins/songs/lib/importers/songimport.py 2015-12-20 19:34:43 +0000
@@ -255,13 +255,13 @@
255 if author2:255 if author2:
256 self.add_author(author2)256 self.add_author(author2)
257257
258 def add_author(self, author):258 def add_author(self, author, type=None):
259 """259 """
260 Add an author to the list260 Add an author to the list
261 """261 """
262 if author in self.authors:262 if (author, type) in self.authors:
263 return263 return
264 self.authors.append(author)264 self.authors.append((author, type))
265265
266 def add_media_file(self, filename, weight=0):266 def add_media_file(self, filename, weight=0):
267 """267 """
@@ -360,13 +360,13 @@
360 song.comments = self.comments360 song.comments = self.comments
361 song.theme_name = self.theme_name361 song.theme_name = self.theme_name
362 song.ccli_number = self.ccli_number362 song.ccli_number = self.ccli_number
363 for author_text in self.authors:363 for author_text, author_type in self.authors:
364 author = self.manager.get_object_filtered(Author, Author.display_name == author_text)364 author = self.manager.get_object_filtered(Author, Author.display_name == author_text)
365 if not author:365 if not author:
366 author = Author.populate(display_name=author_text,366 author = Author.populate(display_name=author_text,
367 last_name=author_text.split(' ')[-1],367 last_name=author_text.split(' ')[-1],
368 first_name=' '.join(author_text.split(' ')[:-1]))368 first_name=' '.join(author_text.split(' ')[:-1]))
369 song.add_author(author)369 song.add_author(author, author_type)
370 if self.song_book_name:370 if self.song_book_name:
371 song_book = self.manager.get_object_filtered(Book, Book.name == self.song_book_name)371 song_book = self.manager.get_object_filtered(Book, Book.name == self.song_book_name)
372 if song_book is None:372 if song_book is None:
373373
=== added file 'openlp/plugins/songs/lib/importers/videopsalm.py'
--- openlp/plugins/songs/lib/importers/videopsalm.py 1970-01-01 00:00:00 +0000
+++ openlp/plugins/songs/lib/importers/videopsalm.py 2015-12-20 19:34:43 +0000
@@ -0,0 +1,123 @@
1# -*- coding: utf-8 -*-
2# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
3
4###############################################################################
5# OpenLP - Open Source Lyrics Projection #
6# --------------------------------------------------------------------------- #
7# Copyright (c) 2008-2015 OpenLP Developers #
8# --------------------------------------------------------------------------- #
9# This program is free software; you can redistribute it and/or modify it #
10# under the terms of the GNU General Public License as published by the Free #
11# Software Foundation; version 2 of the License. #
12# #
13# This program is distributed in the hope that it will be useful, but WITHOUT #
14# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
15# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
16# more details. #
17# #
18# You should have received a copy of the GNU General Public License along #
19# with this program; if not, write to the Free Software Foundation, Inc., 59 #
20# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
21###############################################################################
22"""
23The :mod:`lyrix` module provides the functionality for importing songs which are
24exproted from Lyrix."""
25
26import logging
27import json
28import os
29
30from openlp.core.common import translate
31from openlp.plugins.songs.lib import VerseType
32from openlp.plugins.songs.lib.importers.songimport import SongImport
33from openlp.plugins.songs.lib.db import AuthorType
34
35log = logging.getLogger(__name__)
36
37
38class VideoPsalmImport(SongImport):
39 """
40 Import songs exported from Lyrix
41 """
42
43 def __init__(self, manager, **kwargs):
44 """
45 Initialise the class.
46 """
47 super(VideoPsalmImport, self).__init__(manager, **kwargs)
48
49 def do_import(self):
50 """
51 Process the VideoPsalm file - pass in a file-like object, not a file path.
52 """
53 self.set_defaults()
54 # Open SongBook file
55 song_file = open(self.import_source, 'rt', encoding='utf-8-sig')
56 try:
57 file_content = song_file.read()
58 processed_content = ''
59 inside_quotes = False
60 # The VideoPsalm format is not valid json, it uses illegal line breaks and unquoted keys, this must be fixed
61 file_content_it = iter(file_content)
62 for c in file_content_it:
63 if c == '"':
64 inside_quotes = not inside_quotes
65 # Detect invalid linebreak
66 if c == '\n':
67 if inside_quotes:
68 processed_content += '\\n'
69 # Put keys in quotes
70 elif c.isalnum() and not inside_quotes:
71 processed_content += '"' + c
72 c = next(file_content_it)
73 while c.isalnum():
74 processed_content += c
75 c = next(file_content_it)
76 processed_content += '"' + c
77 else:
78 processed_content += c
79 songbook = json.loads(processed_content.strip())
80 # Get song array
81 songs = songbook['Songs']
82 self.import_wizard.progress_bar.setMaximum(len(songs))
83 songbook_name = songbook['Text']
84 media_folder = os.path.normpath(os.path.join(os.path.dirname(song_file.name), '..', 'Audio'))
85 for song in songs:
86 self.song_book_name = songbook_name
87 if 'Text' in song:
88 self.title = song['Text']
89 composer = None
90 author = None
91 if 'Composer' in song:
92 composer = song['Composer']
93 if 'Author' in song:
94 author = song['Author']
95 if author and composer == author:
96 self.add_author(author, AuthorType.WordsAndMusic)
97 else:
98 if author:
99 self.add_author(author, AuthorType.Words)
100 if composer:
101 self.add_author(composer, AuthorType.Music)
102 if 'Copyright' in song:
103 self.add_copyright(song['Copyright'].replace('\n', ' ').strip())
104 if 'CCLI' in song:
105 self.ccli_number = song['CCLI']
106 if 'Theme' in song:
107 self.topics = song['Theme'].splitlines()
108 if 'AudioFile' in song:
109 self.add_media_file(os.path.join(media_folder, song['AudioFile']))
110 if 'Memo1' in song:
111 self.add_comment(song['Memo1'])
112 if 'Memo2' in song:
113 self.add_comment(song['Memo2'])
114 if 'Memo3' in song:
115 self.add_comment(song['Memo3'])
116 for verse in song['Verses']:
117 self.add_verse(verse['Text'], 'v')
118 if not self.finish():
119 self.log_error('Could not import %s' % self.title)
120 except Exception as e:
121 self.log_error(translate('SongsPlugin.VideoPsalmImport', 'File %s' % file.name),
122 translate('SongsPlugin.VideoPsalmImport', 'Error: %s') % e)
123 song_file.close()
0124
=== added file 'tests/functional/openlp_plugins/songs/test_lyriximport.py'
--- tests/functional/openlp_plugins/songs/test_lyriximport.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songs/test_lyriximport.py 2015-12-20 19:34:43 +0000
@@ -0,0 +1,53 @@
1# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
2
3###############################################################################
4# OpenLP - Open Source Lyrics Projection #
5# --------------------------------------------------------------------------- #
6# Copyright (c) 2008-2015 OpenLP Developers #
7# --------------------------------------------------------------------------- #
8# This program is free software; you can redistribute it and/or modify it #
9# under the terms of the GNU General Public License as published by the Free #
10# Software Foundation; version 2 of the License. #
11# #
12# This program is distributed in the hope that it will be useful, but WITHOUT #
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
15# more details. #
16# #
17# You should have received a copy of the GNU General Public License along #
18# with this program; if not, write to the Free Software Foundation, Inc., 59 #
19# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20###############################################################################
21"""
22This module contains tests for the LyriX song importer.
23"""
24
25import os
26from unittest import TestCase
27
28from tests.helpers.songfileimport import SongImportTestHelper
29from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
30from openlp.core.common import Registry
31from tests.functional import patch, MagicMock
32
33TEST_PATH = os.path.abspath(
34 os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'lyrixsongs'))
35
36
37class TestLyrixFileImport(SongImportTestHelper):
38
39 def __init__(self, *args, **kwargs):
40 self.importer_class_name = 'LyrixImport'
41 self.importer_module_name = 'lyrix'
42 super(TestLyrixFileImport, self).__init__(*args, **kwargs)
43
44 def test_song_import(self):
45 """
46 Test that loading an LyriX file works correctly on various files
47 """
48 self.file_import([os.path.join(TEST_PATH, 'A06.TXT')],
49 self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace.json')))
50 self.file_import([os.path.join(TEST_PATH, 'A002.TXT')],
51 self.load_external_result_data(os.path.join(TEST_PATH, 'Amazing Grace2.json')))
52 self.file_import([os.path.join(TEST_PATH, 'AO05.TXT')],
53 self.load_external_result_data(os.path.join(TEST_PATH, 'in die regterhand.json')))
054
=== modified file 'tests/functional/openlp_plugins/songs/test_songbeamerimport.py'
--- tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2015-01-18 13:39:21 +0000
+++ tests/functional/openlp_plugins/songs/test_songbeamerimport.py 2015-12-20 19:34:43 +0000
@@ -26,27 +26,28 @@
26import os26import os
27from unittest import TestCase27from unittest import TestCase
2828
29from tests.helpers.songfileimport import SongImportTestHelper
29from tests.functional import MagicMock, patch30from tests.functional import MagicMock, patch
30from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport31from openlp.plugins.songs.lib.importers.songbeamer import SongBeamerImport
31from openlp.plugins.songs.lib import VerseType
32from openlp.core.common import Registry32from openlp.core.common import Registry
3333
34TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),34TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__),
35 '..', '..', '..', 'resources', 'songbeamersongs'))35 '..', '..', '..', 'resources', 'songbeamersongs'))
36SONG_TEST_DATA = {36
37 'Lobsinget dem Herrn.sng': {37
38 'title': 'GL 1 - Lobsinget dem Herrn',38class TestSongBeamerFileImport(SongImportTestHelper):
39 'verses': [39
40 ('1. Lobsinget dem Herrn,\no preiset Ihn gern!\nAnbetung und Lob Ihm gebühret.\n', 'v'),40 def __init__(self, *args, **kwargs):
41 ('2. Lobsingt Seiner Lieb´,\ndie einzig ihn trieb,\nzu sterben für unsere Sünden!\n', 'v'),41 self.importer_class_name = 'SongBeamerImport'
42 ('3. Lobsingt Seiner Macht!\nSein Werk ist vollbracht:\nEr sitzet zur Rechten des Vaters.\n', 'v'),42 self.importer_module_name = 'songbeamer'
43 ('4. Lobsingt seiner Treu´,\ndie immerdar neu,\nbis Er uns zur Herrlichket führet!\n\n', 'v')43 super(TestSongBeamerFileImport, self).__init__(*args, **kwargs)
44 ],44
45 'song_book_name': 'Glaubenslieder I',45 def test_song_import(self):
46 'song_number': "1",46 """
47 'authors': ['Carl Brockhaus', 'Johann Jakob Vetter']47 Test that loading an OpenSong file works correctly on various files
48 }48 """
49}49 self.file_import([os.path.join(TEST_PATH, 'Lobsinget dem Herrn.sng')],
50 self.load_external_result_data(os.path.join(TEST_PATH, 'Lobsinget dem Herrn.json')))
5051
5152
52class TestSongBeamerImport(TestCase):53class TestSongBeamerImport(TestCase):
@@ -115,51 +116,6 @@
115 'do_import should return None when import_source is a list and stop_import_flag is True')116 'do_import should return None when import_source is a list and stop_import_flag is True')
116 mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))117 mocked_import_wizard.progress_bar.setMaximum.assert_called_with(len(importer.import_source))
117118
118 def file_import_test(self):
119 """
120 Test the actual import of real song files and check that the imported data is correct.
121 """
122
123 # GIVEN: Test files with a mocked out SongImport class, a mocked out "manager", a mocked out "import_wizard",
124 # and mocked out "author", "add_copyright", "add_verse", "finish" methods.
125 with patch('openlp.plugins.songs.lib.importers.songbeamer.SongImport'):
126 for song_file in SONG_TEST_DATA:
127 mocked_manager = MagicMock()
128 mocked_import_wizard = MagicMock()
129 mocked_add_verse = MagicMock()
130 mocked_finish = MagicMock()
131 mocked_finish.return_value = True
132 importer = SongBeamerImport(mocked_manager, filenames=[])
133 importer.import_wizard = mocked_import_wizard
134 importer.stop_import_flag = False
135 importer.add_verse = mocked_add_verse
136 importer.finish = mocked_finish
137
138 # WHEN: Importing each file
139 importer.import_source = [os.path.join(TEST_PATH, song_file)]
140 title = SONG_TEST_DATA[song_file]['title']
141 add_verse_calls = SONG_TEST_DATA[song_file]['verses']
142 song_book_name = SONG_TEST_DATA[song_file]['song_book_name']
143 song_number = SONG_TEST_DATA[song_file]['song_number']
144 song_authors = SONG_TEST_DATA[song_file]['authors']
145
146 # THEN: do_import should return none, the song data should be as expected, and finish should have been
147 # called.
148 self.assertIsNone(importer.do_import(), 'do_import should return None when it has completed')
149 self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (song_file, title))
150 for verse_text, verse_tag in add_verse_calls:
151 mocked_add_verse.assert_any_call(verse_text, verse_tag)
152 if song_book_name:
153 self.assertEqual(importer.song_book_name, song_book_name,
154 'song_book_name for %s should be "%s"' % (song_file, song_book_name))
155 if song_number:
156 self.assertEqual(importer.song_number, song_number,
157 'song_number for %s should be %s' % (song_file, song_number))
158 if song_authors:
159 for author in importer.authors:
160 self.assertIn(author, song_authors)
161 mocked_finish.assert_called_with()
162
163 def check_verse_marks_test(self):119 def check_verse_marks_test(self):
164 """120 """
165 Tests different lines to see if a verse mark is detected or not121 Tests different lines to see if a verse mark is detected or not
166122
=== modified file 'tests/functional/openlp_plugins/songs/test_songselect.py'
--- tests/functional/openlp_plugins/songs/test_songselect.py 2015-12-17 21:43:49 +0000
+++ tests/functional/openlp_plugins/songs/test_songselect.py 2015-12-20 19:34:43 +0000
@@ -28,6 +28,7 @@
2828
29from PyQt4 import QtGui29from PyQt4 import QtGui
3030
31from tests.helpers.songfileimport import SongImportTestHelper
31from openlp.core import Registry32from openlp.core import Registry
32from openlp.plugins.songs.forms.songselectform import SongSelectForm, SearchWorker33from openlp.plugins.songs.forms.songselectform import SongSelectForm, SearchWorker
33from openlp.plugins.songs.lib import Song34from openlp.plugins.songs.lib import Song
@@ -37,6 +38,9 @@
37from tests.functional import MagicMock, patch, call38from tests.functional import MagicMock, patch, call
38from tests.helpers.testmixin import TestMixin39from tests.helpers.testmixin import TestMixin
3940
41TEST_PATH = os.path.abspath(
42 os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'songselect'))
43
4044
41class TestSongSelectImport(TestCase, TestMixin):45class TestSongSelectImport(TestCase, TestMixin):
42 """46 """
@@ -645,68 +649,21 @@
645 mocked_view_button.setEnabled.assert_called_with(True)649 mocked_view_button.setEnabled.assert_called_with(True)
646650
647651
648class TestSongSelectFileImport(TestCase, TestMixin):652class TestSongSelectFileImport(SongImportTestHelper):
649 """653
650 Test SongSelect file import654 def __init__(self, *args, **kwargs):
651 """655 self.importer_class_name = 'CCLIFileImport'
652 def setUp(self):656 self.importer_module_name = 'cclifile'
653 """657 super(TestSongSelectFileImport, self).__init__(*args, **kwargs)
654 Initial setups658
655 """659 def test_song_import(self):
656 Registry.create()660 """
657 test_song_name = 'TestSong'661 Test that loading an OpenSong file works correctly on various files
658 self.file_name = os.path.join('tests', 'resources', 'songselect', test_song_name)662 """
659 self.title = 'Test Song'663 self.file_import([os.path.join(TEST_PATH, 'TestSong.bin')],
660 self.ccli_number = '0000000'664 self.load_external_result_data(os.path.join(TEST_PATH, 'TestSong-bin.json')))
661 self.authors = ['Author One', 'Author Two']665 self.file_import([os.path.join(TEST_PATH, 'TestSong.txt')],
662 self.topics = ['Adoration', 'Praise']666 self.load_external_result_data(os.path.join(TEST_PATH, 'TestSong-txt.json')))
663
664 def songselect_import_bin_file_test(self):
665 """
666 Verify import SongSelect BIN file parses file properly
667 """
668 # GIVEN: Text file to import and mocks
669 copyright_bin = '2011 OpenLP Programmer One (Admin. by OpenLP One) | ' \
670 'Openlp Programmer Two (Admin. by OpenLP Two)'
671 verses_bin = [
672 ['v1', 'Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One', None],
673 ['v2', 'Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two', None]
674 ]
675 song_import = CCLIFileImport(manager=None, filename=['{}.bin'.format(self.file_name)])
676
677 with patch.object(song_import, 'import_wizard'), patch.object(song_import, 'finish'):
678 # WHEN: We call the song importer
679 song_import.do_import()
680 # THEN: Song values should be equal to test values in setUp
681 self.assertEquals(song_import.title, self.title, 'Song title should match')
682 self.assertEquals(song_import.ccli_number, self.ccli_number, 'CCLI Song Number should match')
683 self.assertEquals(song_import.authors, self.authors, 'Author(s) should match')
684 self.assertEquals(song_import.copyright, copyright_bin, 'Copyright should match')
685 self.assertEquals(song_import.topics, self.topics, 'Theme(s) should match')
686 self.assertEquals(song_import.verses, verses_bin, 'Verses should match with test verses')
687
688 def songselect_import_text_file_test(self):
689 """
690 Verify import SongSelect TEXT file parses file properly
691 """
692 # GIVEN: Text file to import and mocks
693 copyright_txt = '© 2011 OpenLP Programmer One (Admin. by OpenLP One)'
694 verses_txt = [
695 ['v1', 'Line One Verse One\r\nLine Two Verse One\r\nLine Three Verse One\r\nLine Four Verse One', None],
696 ['v2', 'Line One Verse Two\r\nLine Two Verse Two\r\nLine Three Verse Two\r\nLine Four Verse Two', None]
697 ]
698 song_import = CCLIFileImport(manager=None, filename=['{}.txt'.format(self.file_name)])
699
700 with patch.object(song_import, 'import_wizard'), patch.object(song_import, 'finish'):
701 # WHEN: We call the song importer
702 song_import.do_import()
703
704 # THEN: Song values should be equal to test values in setUp
705 self.assertEquals(song_import.title, self.title, 'Song title should match')
706 self.assertEquals(song_import.ccli_number, self.ccli_number, 'CCLI Song Number should match')
707 self.assertEquals(song_import.authors, self.authors, 'Author(s) should match')
708 self.assertEquals(song_import.copyright, copyright_txt, 'Copyright should match')
709 self.assertEquals(song_import.verses, verses_txt, 'Verses should match with test verses')
710667
711668
712class TestSearchWorker(TestCase, TestMixin):669class TestSearchWorker(TestCase, TestMixin):
713670
=== added file 'tests/functional/openlp_plugins/songs/test_videopsalm.py'
--- tests/functional/openlp_plugins/songs/test_videopsalm.py 1970-01-01 00:00:00 +0000
+++ tests/functional/openlp_plugins/songs/test_videopsalm.py 2015-12-20 19:34:43 +0000
@@ -0,0 +1,49 @@
1# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
2
3###############################################################################
4# OpenLP - Open Source Lyrics Projection #
5# --------------------------------------------------------------------------- #
6# Copyright (c) 2008-2015 OpenLP Developers #
7# --------------------------------------------------------------------------- #
8# This program is free software; you can redistribute it and/or modify it #
9# under the terms of the GNU General Public License as published by the Free #
10# Software Foundation; version 2 of the License. #
11# #
12# This program is distributed in the hope that it will be useful, but WITHOUT #
13# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
14# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
15# more details. #
16# #
17# You should have received a copy of the GNU General Public License along #
18# with this program; if not, write to the Free Software Foundation, Inc., 59 #
19# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
20###############################################################################
21"""
22This module contains tests for the VideoPsalm song importer.
23"""
24
25import os
26from unittest import TestCase
27
28from tests.helpers.songfileimport import SongImportTestHelper
29from openlp.plugins.songs.lib.importers.opensong import OpenSongImport
30from openlp.core.common import Registry
31from tests.functional import patch, MagicMock
32
33TEST_PATH = os.path.abspath(
34 os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources', 'videopsalmsongs'))
35
36
37class TestVideoPsalmFileImport(SongImportTestHelper):
38
39 def __init__(self, *args, **kwargs):
40 self.importer_class_name = 'VideoPsalmImport'
41 self.importer_module_name = 'videopsalm'
42 super(TestVideoPsalmFileImport, self).__init__(*args, **kwargs)
43
44 def test_song_import(self):
45 """
46 Test that loading an VideoPsalm file works correctly on various files
47 """
48 self.file_import(os.path.join(TEST_PATH, 'videopsalm-as-safe-a-stronghold.json'),
49 self.load_external_result_data(os.path.join(TEST_PATH, 'as-safe-a-stronghold.json')))
050
=== modified file 'tests/helpers/songfileimport.py'
--- tests/helpers/songfileimport.py 2015-01-18 13:39:21 +0000
+++ tests/helpers/songfileimport.py 2015-12-20 19:34:43 +0000
@@ -124,7 +124,10 @@
124124
125 self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title))125 self.assertEqual(importer.title, title, 'title for %s should be "%s"' % (source_file_name, title))
126 for author in author_calls:126 for author in author_calls:
127 self.mocked_add_author.assert_any_call(author)127 if isinstance(author, str):
128 self.mocked_add_author.assert_any_call(author)
129 else:
130 self.mocked_add_author.assert_any_call(*author)
128 if song_copyright:131 if song_copyright:
129 self.mocked_add_copyright.assert_called_with(song_copyright)132 self.mocked_add_copyright.assert_called_with(song_copyright)
130 if ccli_number:133 if ccli_number:
131134
=== added directory 'tests/resources/lyrixsongs'
=== added file 'tests/resources/lyrixsongs/A002.TXT'
--- tests/resources/lyrixsongs/A002.TXT 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/A002.TXT 2015-12-20 19:34:43 +0000
@@ -0,0 +1,34 @@
1
2-------------
3A002
4AMAZING GRACE
5-------------
6
71. AMAZING GRACE! HOW SWEET THE SOUND
8THAT SAVED A WRETCH LIKE ME;
9I ONCE WAS LOST, BUT NOW AM FOUND;
10WAS BLIND, BUT NOW I SEE.
11
122. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR
13AND GRACE MY FEARS RELIEVED;
14HOW PRECIOUS DID THAT GRACE APPEAR,
15THE HOUR I FIRST BELIEVED!
16
173. THROUGH MANY DANGERS, TRIALS AND SNARES
18I HAVE ALREADY COME;
19'TIS GRACE THAT BROUGHT ME SAFE THUS FAR
20AND GRACE WILL LEAD ME HOME.
21
224. THE LORD HAS PROMISED GOOD TO ME,
23HIS WORD MY HOPE SECURES;
24HE WILL MY SHIELD AND FORTRESS BE
25AS LONG AS LIFE ENDURES.
26
275. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS
28BRIGHT SHINING AS THE SUN,
29WE'VE NO LESS DAYS TO SING GOD'S PRAISE
30THAN WHEN WE'D FIRST BEGUN.
31
32CCLI no.: 22025
33Words/Music: Edwin Excell, John Newton, John P. Rees
34Public Domain
035
=== added file 'tests/resources/lyrixsongs/A06.TXT'
--- tests/resources/lyrixsongs/A06.TXT 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/A06.TXT 2015-12-20 19:34:43 +0000
@@ -0,0 +1,31 @@
1
2----------------------------------
3A06
4AMAZING GRACE, HOW SWEET THE SOUND
5----------------------------------
6
71. AMAZING GRACE, HOW SWEET THE SOUND
8THAT SAVED A WRETCH LIKE ME
9I ONCE WAS LOST, BUT NOW I'M FOUND
10WAS BLIND, BUT NOW I SEE
11
122. 'TWAS GRACE THAT TAUGHT MY HEART TO FEAR
13AND GRACE MY FEARS RELIEVED
14HOW PRECIOUS DID THAT GRACE APPEAR
15THE HOUR I FIRST BELIEVED
16
173. THROUGH MANY DANGERS, TOILS AND SNARES
18I HAVE ALREADY COME, 'TWAS GRACE
19THAT BROUGHT ME SAFE THUS FAR
20AND GRACE WILL LEAD ME HOME
21
224. WHEN WE'VE BEEN THERE TEN THOUSAND YEARS
23BRIGHT SHINING AS THE SUN
24WE'VE NO LESS DAYS TO SING GOD'S PRAISE
25THAN WHEN WE'VE FIRST BEGUN
26
275. PRAISE GOD, PRAISE GOD
28PRAISE GOD, PRAISE GOD
29PRAISE GOD, PRAISE GOD
30PRAISE GOD..
31
032
=== added file 'tests/resources/lyrixsongs/AO05.TXT'
--- tests/resources/lyrixsongs/AO05.TXT 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/AO05.TXT 2015-12-20 19:34:43 +0000
@@ -0,0 +1,48 @@
1
2--------------------------------
3AO05
4IN DIE REGTERHAND VAN HOM WAT IN
5--------------------------------
6
71. IN DIE REGTERHAND VAN HOM
8WAT IN MAJESTEIT REGEER
9Lê DIE BOEKROL VAN VERLOSSING
10SEWEMAAL VERSEëL
11EN NIEMAND KON GEVIND WORD
12OM SY SEëLS OOP TE BREEK
13TOT DIE LAM VAN GOD NA VORE KOM
14OM DIE BOEKROL SELF TE NEEM
15DIE VIER-EN-TWINTIG OUDERLINGE
16VAL TOE VOOR HOM NEER
17SAAM MET AL DIE ENG'LE
18IN DIE GANSE HEMELLEëR,
19EN ELKE WESE WAT ASEM HET
20OP DIE AARDE, IN DIE SEE, EN OOR DIE
21LENGTE EN DIE BREEDTE
22VAN DIE SKEPPING BRING HOM EER
23
242. HERE U ALLEEN IS WAARDIG
25OM DIE LEWENSBOEK TE NEEM
26EN U ALLEEN IS MAGTIG
27OM SY SEëLS OOP TE BREEK,
28WANT U'T VIR ONS GESTERWE,
29MET U BLOED HET U BETAAL
30OM ONS LOS TE KOOP
31UIT ELKE STAM EN NASIE,VOLK EN TAAL
32
33AL DIE LOF EN DIE KRAG
34EN DIE EER
35EN DIE HEERLIKHEID
36EN RYKDON EN STERKTE
37AAN U ALLEEN O HEER
38AL DIE LOF EN DIE KRAG
39EN DIE EER
40EN WYSHEID AAN DIE LAM
41OP DIE TROON
42WAT NOU EN TOT IN
43EWIGHEID REGEER
44NOU EN TOT IN EWIGHEID
45REGEER
46DIE LAM WAT TOT IN
47EWIGHEID REGEER
48
049
=== added file 'tests/resources/lyrixsongs/Amazing Grace.json'
--- tests/resources/lyrixsongs/Amazing Grace.json 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/Amazing Grace.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,26 @@
1{
2 "title": "AMAZING GRACE, HOW SWEET THE SOUND",
3 "verse_order_list": [],
4 "verses": [
5 [
6 "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",
7 "v"
8 ],
9 [
10 "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",
11 "v"
12 ],
13 [
14 "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",
15 "v"
16 ],
17 [
18 "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",
19 "v"
20 ],
21 [
22 "5. PRAISE GOD, PRAISE GOD\nPRAISE GOD, PRAISE GOD\nPRAISE GOD, PRAISE GOD\nPRAISE GOD..",
23 "v"
24 ]
25 ]
26}
027
=== added file 'tests/resources/lyrixsongs/Amazing Grace2.json'
--- tests/resources/lyrixsongs/Amazing Grace2.json 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/Amazing Grace2.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,33 @@
1{
2 "authors": [
3 "John Newton",
4 "Edwin Excell",
5 "John P. Rees"
6 ],
7 "ccli_number": "22025",
8 "copyright": "Public Domain",
9 "title": "AMAZING GRACE",
10 "verse_order_list": [],
11 "verses": [
12 [
13 "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.",
14 "v"
15 ],
16 [
17 "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!",
18 "v"
19 ],
20 [
21 "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.",
22 "v"
23 ],
24 [
25 "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.",
26 "v"
27 ],
28 [
29 "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.",
30 "v"
31 ]
32 ]
33}
034
=== added file 'tests/resources/lyrixsongs/in die regterhand.json'
--- tests/resources/lyrixsongs/in die regterhand.json 1970-01-01 00:00:00 +0000
+++ tests/resources/lyrixsongs/in die regterhand.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,18 @@
1{
2 "title": "IN DIE REGTERHAND VAN HOM WAT IN",
3 "verse_order_list": [],
4 "verses": [
5 [
6 "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",
7 "v"
8 ],
9 [
10 "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",
11 "v"
12 ],
13 [
14 "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",
15 "v"
16 ]
17 ]
18}
019
=== added file 'tests/resources/songbeamersongs/Lobsinget dem Herrn.json'
--- tests/resources/songbeamersongs/Lobsinget dem Herrn.json 1970-01-01 00:00:00 +0000
+++ tests/resources/songbeamersongs/Lobsinget dem Herrn.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,12 @@
1{
2 "title": "GL 1 - Lobsinget dem Herrn",
3 "verses": [
4 ["1. Lobsinget dem Herrn,\no preiset Ihn gern!\nAnbetung und Lob Ihm gebühret.\n", "v"],
5 ["2. Lobsingt Seiner Lieb´,\ndie einzig ihn trieb,\nzu sterben für unsere Sünden!\n", "v"],
6 ["3. Lobsingt Seiner Macht!\nSein Werk ist vollbracht:\nEr sitzet zur Rechten des Vaters.\n", "v"],
7 ["4. Lobsingt seiner Treu´,\ndie immerdar neu,\nbis Er uns zur Herrlichket führet!\n\n", "v"]
8 ],
9 "song_book_name": "Glaubenslieder I",
10 "song_number": "1",
11 "authors": ["Carl Brockhaus", "Johann Jakob Vetter"]
12}
013
=== added file 'tests/resources/songselect/TestSong-bin.json'
--- tests/resources/songselect/TestSong-bin.json 1970-01-01 00:00:00 +0000
+++ tests/resources/songselect/TestSong-bin.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,25 @@
1{
2 "authors": [
3 "Author One",
4 "Author Two"
5 ],
6 "ccli_number": "0000000",
7 "song_number": 0,
8 "title": "Test Song",
9 "topics": [
10 "Adoration",
11 "Praise"
12 ],
13 "copyright": "2011 OpenLP Programmer One (Admin. by OpenLP One) | Openlp Programmer Two (Admin. by OpenLP Two)",
14 "verse_order_list": [],
15 "verses": [
16 [
17 "Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One\n",
18 "v"
19 ],
20 [
21 "Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two\n",
22 "v"
23 ]
24 ]
25}
026
=== added file 'tests/resources/songselect/TestSong-txt.json'
--- tests/resources/songselect/TestSong-txt.json 1970-01-01 00:00:00 +0000
+++ tests/resources/songselect/TestSong-txt.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,21 @@
1{
2 "authors": [
3 "Author One",
4 "Author Two"
5 ],
6 "ccli_number": "0000000",
7 "song_number": 0,
8 "title": "Test Song",
9 "copyright": "© 2011 OpenLP Programmer One (Admin. by OpenLP One)",
10 "verse_order_list": [],
11 "verses": [
12 [
13 "Line One Verse One\nLine Two Verse One\nLine Three Verse One\nLine Four Verse One\n",
14 "v"
15 ],
16 [
17 "Line One Verse Two\nLine Two Verse Two\nLine Three Verse Two\nLine Four Verse Two\n",
18 "v"
19 ]
20 ]
21}
022
=== added directory 'tests/resources/videopsalmsongs'
=== added file 'tests/resources/videopsalmsongs/as-safe-a-stronghold.json'
--- tests/resources/videopsalmsongs/as-safe-a-stronghold.json 1970-01-01 00:00:00 +0000
+++ tests/resources/videopsalmsongs/as-safe-a-stronghold.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,35 @@
1{
2 "authors": [
3 ["Martin Luther", "words"],
4 ["Unknown", "music"]
5 ],
6 "ccli_number": "12345",
7 "comments": "This is\nthe first comment\nThis is\nthe second comment\nThis is\nthe third comment\n",
8 "copyright": "Public Domain",
9 "song_book_name": "SongBook1",
10 "song_number": 0,
11 "title": "A Safe Stronghold Our God is Still",
12 "topics": [
13 "tema1",
14 "tema2"
15 ],
16 "verse_order_list": [],
17 "verses": [
18 [
19 "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.",
20 "v"
21 ],
22 [
23 "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.",
24 "v"
25 ],
26 [
27 "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.",
28 "v"
29 ],
30 [
31 "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.",
32 "v"
33 ]
34 ]
35}
036
=== added file 'tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json'
--- tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json 1970-01-01 00:00:00 +0000
+++ tests/resources/videopsalmsongs/videopsalm-as-safe-a-stronghold.json 2015-12-20 19:34:43 +0000
@@ -0,0 +1,47 @@
1{Abbreviation:"SB1",Copyright:"Public domain",Songs:[{ID:3,Composer:"Unknown",Author:"Martin Luther",Copyright:"Public
2Domain",Theme:"tema1
3tema2",CCLI:"12345",Alias:"A safe stronghold",Memo1:"This is
4the first comment
5",Memo2:"This is
6the second comment
7",Memo3:"This is
8the third comment
9",Reference:"reference",Guid:"jtCkrJdPIUOmECjaQylg/g",Verses:[{
10Text:"As safe a stronghold our God is still,
11A trusty shield and weapon;
12He’ll help us clear from all the ill
13That hath us now o’ertaken.
14The ancient prince of hell
15Hath risen with purpose fell;
16Strong mail of craft and power
17He weareth in this hour;
18On earth is not His fellow."},{ID:2,
19Text:"With force of arms we nothing can,
20Full soon were we down-ridden;
21But for us fights the proper Man,
22Whom God Himself hath bidden.
23Ask ye: Who is this same?
24Christ Jesus is His name,
25The Lord Sabaoth’s Son;
26He, and no other one,
27Shall conquer in the battle."},{ID:3,
28Text:"And were this world all devils o’er,
29And watching to devour us,
30We lay it not to heart so sore;
31Not they can overpower us.
32And let the prince of ill
33Look grim as e’er he will,
34He harms us not a whit;
35For why? his doom is writ;
36A word shall quickly slay him."},{ID:4,
37Text:"God’s word, for all their craft and force,
38One moment will not linger,
39But, spite of hell, shall have its course;
40’Tis written by His finger.
41And though they take our life,
42Goods, honour, children, wife,
43Yet is their profit small:
44These things shall vanish all;
45The city of God remaineth."}],AudioFile:"282.mp3",IsAudioFileEnabled:1,
46Text:"A Safe Stronghold Our God is Still"}],Guid:"khiHU2blX0Kb41dGdbDLhA",VersionDate:"20121012000000",
47Text:"SongBook1"}