Merge branch 'alpha-fixes5' into 'master'

Fix loading optical and streaming items from servicemanager.

See merge request openlp/openlp!178
This commit is contained in:
Tim Bentley 2020-05-02 20:10:24 +00:00
commit ca6ed027d3
2 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
########################################################################## ##########################################################################
# OpenLP - Open Source Lyrics Projection # # 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 import ItemCapabilities
from openlp.core.lib.theme import BackgroundType from openlp.core.lib.theme import BackgroundType
from openlp.core.ui.icons import UiIcons from openlp.core.ui.icons import UiIcons
from openlp.core.ui.media import parse_stream_path
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -692,6 +692,11 @@ class ServiceItem(RegistryProperties):
if not os.path.exists(slide['title']): if not os.path.exists(slide['title']):
self.is_valid = False self.is_valid = False
break 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: else:
file_name = os.path.join(slide['path'], slide['title']) file_name = os.path.join(slide['path'], slide['title'])
if not os.path.exists(file_name): if not os.path.exists(file_name):

View File

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