forked from openlp/openlp
Add metadata
This commit is contained in:
parent
a50ada5030
commit
14b8aedc76
@ -121,6 +121,9 @@ class ItemCapabilities(object):
|
||||
|
||||
``HasThumbnails``
|
||||
The item has related thumbnails available
|
||||
|
||||
``HasMetaData``
|
||||
The item has Meta Data about item
|
||||
"""
|
||||
CanPreview = 1
|
||||
CanEdit = 2
|
||||
@ -143,6 +146,7 @@ class ItemCapabilities(object):
|
||||
HasDisplayTitle = 19
|
||||
HasNotes = 20
|
||||
HasThumbnails = 21
|
||||
HasMetaData = 22
|
||||
|
||||
|
||||
class ServiceItem(RegistryProperties):
|
||||
@ -200,6 +204,7 @@ class ServiceItem(RegistryProperties):
|
||||
self.will_auto_start = False
|
||||
self.has_original_files = True
|
||||
self._new_item()
|
||||
self.metadata = []
|
||||
|
||||
def _new_item(self):
|
||||
"""
|
||||
@ -375,7 +380,8 @@ class ServiceItem(RegistryProperties):
|
||||
'background_audio': self.background_audio,
|
||||
'theme_overwritten': self.theme_overwritten,
|
||||
'will_auto_start': self.will_auto_start,
|
||||
'processor': self.processor
|
||||
'processor': self.processor,
|
||||
'metadata': self.metadata
|
||||
}
|
||||
service_data = []
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
@ -426,6 +432,7 @@ class ServiceItem(RegistryProperties):
|
||||
self.will_auto_start = header.get('will_auto_start', False)
|
||||
self.processor = header.get('processor', None)
|
||||
self.has_original_files = True
|
||||
self.metadata = header.get('item_meta_data', [])
|
||||
if 'background_audio' in header:
|
||||
self.background_audio = []
|
||||
for file_path in header['background_audio']:
|
||||
|
@ -572,6 +572,7 @@ class SongMediaItem(MediaManagerItem):
|
||||
service_item.add_capability(ItemCapabilities.OnLoadUpdate)
|
||||
service_item.add_capability(ItemCapabilities.AddIfNewItem)
|
||||
service_item.add_capability(ItemCapabilities.CanSoftBreak)
|
||||
service_item.add_capability(ItemCapabilities.HasMetaData)
|
||||
song = self.plugin.manager.get_object(Song, item_id)
|
||||
service_item.theme = song.theme_name
|
||||
service_item.edit_id = item_id
|
||||
@ -685,6 +686,11 @@ class SongMediaItem(MediaManagerItem):
|
||||
if Settings().value('core/ccli number'):
|
||||
item.raw_footer.append(translate('SongsPlugin.MediaItem',
|
||||
'CCLI License: ') + Settings().value('core/ccli number'))
|
||||
if song.songbook_entries:
|
||||
for songbook_entry in song.songbook_entries:
|
||||
item.metadata.append("songbook: {book}/{num}/{pub}".format(book=songbook_entry.songbook.name,
|
||||
num=songbook_entry.entry,
|
||||
pub=songbook_entry.songbook.publisher))
|
||||
return authors_all
|
||||
|
||||
def service_load(self, item):
|
||||
|
Loading…
Reference in New Issue
Block a user