From fd7ba2a4479d3103b3ba15a968f6173313dba39a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 19 Oct 2020 07:18:00 +0000 Subject: [PATCH] Song details api --- openlp/core/lib/serviceitem.py | 1 + openlp/plugins/songs/lib/mediaitem.py | 4 +++- tests/functional/openlp_core/lib/test_serviceitem.py | 9 ++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 687df9422..5c186ecf4 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -883,6 +883,7 @@ class ServiceItem(RegistryProperties): 'footer': self.raw_footer, 'audit': self.audit, 'notes': self.notes, + 'data': self.data_string or {}, 'fromPlugin': self.from_plugin, 'capabilities': self.capabilities, 'backgroundAudio': [str(file_path) for file_path in self.background_audio], diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d1ebacb7f..ad43f6605 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -616,8 +616,10 @@ class SongMediaItem(MediaManagerItem): author_list = self.generate_footer(service_item, song) service_item.data_string = { 'title': song.search_title, + 'alternate_title': song.alternate_title, 'authors': ', '.join(author_list), - 'ccli_number': song.ccli_number + 'ccli_number': song.ccli_number, + 'copyright': song.copyright } service_item.xml_version = self.open_lyrics.song_to_xml(song) # Add the audio file to the service item. diff --git a/tests/functional/openlp_core/lib/test_serviceitem.py b/tests/functional/openlp_core/lib/test_serviceitem.py index ed9569e34..c732683b1 100644 --- a/tests/functional/openlp_core/lib/test_serviceitem.py +++ b/tests/functional/openlp_core/lib/test_serviceitem.py @@ -804,7 +804,8 @@ def test_to_dict_text_item(state_media, settings, service_item_env): ], 'theme': None, 'title': 'Amazing Grace', - 'type': 'ServiceItemType.Text' + 'type': 'ServiceItemType.Text', + 'data': {'authors': 'John Newton', 'title': 'amazing grace@'} } assert result == expected_dict @@ -854,7 +855,8 @@ def test_to_dict_image_item(mocked_image_to_data_uri, mocked_get_data_path, stat ], 'theme': -1, 'title': 'Images', - 'type': 'ServiceItemType.Image' + 'type': 'ServiceItemType.Image', + 'data': {} } assert result == expected_dict @@ -909,6 +911,7 @@ def test_to_dict_presentation_item(mocked_image_uri, mocked_get_data_path, state ], 'theme': None, 'title': '', - 'type': 'ServiceItemType.Command' + 'type': 'ServiceItemType.Command', + 'data': {} } assert result == expected_dict