Skip to content

Commit

Permalink
invoke plugin:// streams using executebuiltin(PlayMedia(..))
Browse files Browse the repository at this point in the history
  • Loading branch information
twinther committed Jan 19, 2013
1 parent 2f13eac commit 35406d9
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions gui.py
@@ -1,5 +1,5 @@
#
# Copyright (C) 2012 Tommy Winther
# Copyright (C) 2013 Tommy Winther
# http://tommy.winther.nu
#
# This Program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -147,7 +147,7 @@ def __init__(self):
def getControl(self, controlId):
try:
return super(TVGuide, self).getControl(controlId)
except TypeError:
except:
if controlId in self.ignoreMissingControlIds:
return None
if not self.isClosing:
Expand Down Expand Up @@ -528,23 +528,32 @@ def playChannel(self, channel):
wasPlaying = self.player.isPlaying()
url = self.database.getStreamUrl(channel)
if url:
self.player.play(item = url, windowed = self.osdEnabled)
for retry in range(0, 10):
xbmc.sleep(100)
if self.player.isPlaying():
break
if url[0:9] == 'plugin://':
if self.osdEnabled:
xbmc.executebuiltin('PlayMedia(%s,1)' % url)
else:
xbmc.executebuiltin('PlayMedia(%s)' % url)
if not wasPlaying:
self._hideEpg()
else:
self.player.play(item = url, windowed = self.osdEnabled)

threading.Timer(1, self.waitForPlayBackStopped).start()
for retry in range(0, 10):
xbmc.sleep(100)
if self.player.isPlaying():
break

if not wasPlaying and self.player.isPlaying():
self._hideEpg()

if not wasPlaying and self.player.isPlaying():
self._hideEpg()

threading.Timer(1, self.waitForPlayBackStopped).start()
self.osdProgram = self.database.getCurrentProgram(self.currentChannel)

return self.player.isPlaying()
return url is not None

def waitForPlayBackStopped(self):
while self.player.isPlaying():
while self.player.isPlaying() and not xbmc.abortRequested and not self.isClosing:
time.sleep(0.5)
self.onPlayBackStopped()

Expand Down

0 comments on commit 35406d9

Please sign in to comment.