From 1fb99e543e9be413d8f5d700bd06ef78ebf0cdc6 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Sat, 2 May 2020 14:04:53 +0200 Subject: [PATCH] When creating media service items, validate items after adding capabilities. Fixes loading optical and streaming items from servicemanager. --- openlp/core/lib/serviceitem.py | 7 ++++++- openlp/plugins/media/lib/mediaitem.py | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 42389be24..bfcee18ed 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -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): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index f0ffee8a6..56065ea40 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -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):