When creating media service items, validate items after adding capabilities. Fixes loading optical and streaming items from servicemanager.

This commit is contained in:
Tomas Groth 2020-05-02 14:04:53 +02:00
parent d4f75e4fb4
commit 1fb99e543e
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
##########################################################################
# OpenLP - Open Source Lyrics Projection #
# ---------------------------------------------------------------------- #
@ -43,6 +42,7 @@ from openlp.core.display.render import remove_tags, render_tags, render_chords_f
from openlp.core.lib import ItemCapabilities
from openlp.core.lib.theme import BackgroundType
from openlp.core.ui.icons import UiIcons
from openlp.core.ui.media import parse_stream_path
log = logging.getLogger(__name__)
@ -692,6 +692,11 @@ class ServiceItem(RegistryProperties):
if not os.path.exists(slide['title']):
self.is_valid = False
break
elif self.is_capable(ItemCapabilities.CanStream):
(name, mrl, options) = parse_stream_path(slide['path'])
if not name or not mrl or not options:
self.is_valid = False
break
else:
file_name = os.path.join(slide['path'], slide['title'])
if not os.path.exists(file_name):

View File

@ -201,6 +201,8 @@ class MediaMediaItem(MediaManagerItem, RegistryProperties):
service_item.will_auto_start = True
# force a non-existent theme
service_item.theme = -1
# validate the item after all capabilities has been added
service_item.validate_item()
return True
def initialise(self):