Skip to content

Commit e47f453

Browse files
Huevoslittlesat
authored andcommitted
[Navigation.playServiceExtensions] update handling
Break loop once a match is found. This is needed for when multiple plugins are using Navigation.playServiceExtensions. Also, allow plugins that only return sref, and do not return is_async_play.
1 parent a09fb6e commit e47f453

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

lib/python/Navigation.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust
121121
adjust = adjust[0]
122122
oldref = self.currentlyPlayingServiceOrGroup
123123
current_service_source = None
124-
is_handled = False
124+
is_async_play = False
125125
if InfoBarInstance:
126126
current_service_source = InfoBarInstance.session.screen["CurrentService"]
127127

@@ -195,8 +195,15 @@ def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust
195195
if BoxInfo.getItem("FCCactive") and "%3a//" in ref.toString() and not is_stream_relay:
196196
self.pnav.stopService()
197197

198+
playref_str_orig = playref.toString()
198199
for f in Navigation.playServiceExtensions:
199-
playref, is_handled = f(self, playref, event, InfoBarInstance)
200+
ret = f(self, playref, event, InfoBarInstance)
201+
if isinstance(ret, (ServiceReference, eServiceReference)):
202+
playref = ret
203+
else:
204+
playref, is_async_play = ret
205+
if is_async_play or playref.toString() != playref_str_orig:
206+
break
200207

201208
self.currentlyPlayingServiceOrGroup = ref
202209
if startPlayingServiceOrGroup and startPlayingServiceOrGroup.flags & eServiceReference.isGroup and not ref.flags & eServiceReference.isGroup:
@@ -239,7 +246,7 @@ def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust
239246
self.retryServicePlayTimer = eTimer()
240247
self.retryServicePlayTimer.callback.append(boundFunction(self.playService, ref, checkParentalControl, forceRestart, adjust))
241248
self.retryServicePlayTimer.start(config.misc.softcam_streamrelay_delay.value, True)
242-
elif not is_handled and self.pnav.playService(playref):
249+
elif not is_async_play and self.pnav.playService(playref):
243250
self.currentlyPlayingServiceReference = None
244251
self.originalPlayingServiceReference = None
245252
self.currentlyPlayingServiceOrGroup = None
@@ -253,7 +260,7 @@ def playService(self, ref, checkParentalControl=True, forceRestart=False, adjust
253260
setPreferredTuner(int(config.usage.frontend_priority.value))
254261
if self.currentlyPlayingServiceReference and self.currentlyPlayingServiceReference.toString() in streamrelay.data:
255262
self.currentServiceIsStreamRelay = True
256-
if InfoBarInstance and "%3a//" in playref.toString() and not is_handled:
263+
if InfoBarInstance and "%3a//" in playref.toString() and not is_async_play:
257264
self.originalPlayingServiceReference = None
258265
InfoBarInstance.serviceStarted()
259266
return 0

0 commit comments

Comments
 (0)