Parse verse order

This commit is contained in:
Samuel Mehrbrodt 2014-07-03 23:48:52 +02:00
parent 9f34552364
commit 7112356c21
3 changed files with 16 additions and 6 deletions

View File

@ -57,14 +57,25 @@ class PowerpraiseImport(SongImport):
def process_song(self, root):
self.set_defaults()
self.title = root.general.title
count = 0;
verse_order_list = []
for item in root.order.item:
verse_order_list.append(str(item))
count = 0
for part in root.songtext.part:
verse_text = ""
count += 1
verse_def = "v%d" % count
original_verse_def = part.get('caption')
verse_text = ""
for slide in part.slide:
for line in slide.line:
verse_text += line
print(verse_text)
self.add_verse(verse_text, "v%d" % count)
self.add_verse(verse_text, verse_def)
# Update verse name in verse order list
for i in range(len(verse_order_list)):
if verse_order_list[i].lower() == original_verse_def.lower():
verse_order_list[i] = verse_def
self.verse_order_list = verse_order_list
if not self.finish():
self.log_error(self.import_source)

View File

@ -134,7 +134,6 @@ class SongImportTestHelper(TestCase):
self.assertEqual(importer.ccli_number, ccli_number,
'ccli_number for %s should be %s' % (source_file_name, ccli_number))
expected_calls = []
print(self.mocked_add_verse.mock_calls)
for verse_text, verse_tag in add_verse_calls:
self.mocked_add_verse.assert_any_call(verse_text, verse_tag)
expected_calls.append(call(verse_text, verse_tag))

View File

@ -1,6 +1,6 @@
{
"title": "Näher, mein Gott, zu Dir",
"verse_order_list": [],
"verse_order_list": ["v1", "v2", "v3"],
"verses": [
[
"Näher, mein Gott, zu Dir,sei meine Bitt'!Näher, o Herr, zu Dirmit jedem Schritt.Nur an dem Herzen Deinkann ich geborgen sein;deshalb die Bitte mein:Näher zu Dir!",