git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add streaming link. you still need streamproxy (http://streamproxy.schwerkraft.elited...
[enigma2.git]
/
lib
/
python
/
Plugins
/
Extensions
/
WebInterface
/
webif.py
diff --git
a/lib/python/Plugins/Extensions/WebInterface/webif.py
b/lib/python/Plugins/Extensions/WebInterface/webif.py
index 7ec88bb2872387ec7c49667fc4f77c795beb7e2a..a452cb760a09b928e8b74b2afa41fd1b62d8295e 100644
(file)
--- a/
lib/python/Plugins/Extensions/WebInterface/webif.py
+++ b/
lib/python/Plugins/Extensions/WebInterface/webif.py
@@
-28,10
+28,15
@@
import time
# prototype of the new web frontend template system.
# prototype of the new web frontend template system.
-# a test screen
-class TestScreen(InfoBarServiceName, InfoBarEvent, Screen):
+class WebScreen(Screen):
def __init__(self, session):
Screen.__init__(self, session)
def __init__(self, session):
Screen.__init__(self, session)
+ self.stand_alone = True
+
+# a test screen
+class TestScreen(InfoBarServiceName, InfoBarEvent, WebScreen):
+ def __init__(self, session):
+ WebScreen.__init__(self, session)
InfoBarServiceName.__init__(self)
InfoBarEvent.__init__(self)
self["CurrentTime"] = Clock()
InfoBarServiceName.__init__(self)
InfoBarEvent.__init__(self)
self["CurrentTime"] = Clock()
@@
-44,11
+49,17
@@
class TestScreen(InfoBarServiceName, InfoBarEvent, Screen):
self["ServiceListBrowse"] = ServiceList(fav, command_func = self.browseTo)
def browseTo(self, reftobrowse):
self["ServiceListBrowse"] = ServiceList(fav, command_func = self.browseTo)
def browseTo(self, reftobrowse):
- self["ServiceListBrowse"].root = reft
t
obrowse
+ self["ServiceListBrowse"].root = reftobrowse
def zapTo(self, reftozap):
self.session.nav.playService(reftozap)
def zapTo(self, reftozap):
self.session.nav.playService(reftozap)
+class Streaming(WebScreen):
+ def __init__(self, session):
+ WebScreen.__init__(self, session)
+ from Components.Sources.StreamService import StreamService
+ self["StreamService"] = StreamService(self.session.nav)
+
# implements the 'render'-call.
# this will act as a downstream_element, like a renderer.
class OneTimeElement(Element):
# implements the 'render'-call.
# this will act as a downstream_element, like a renderer.
class OneTimeElement(Element):
@@
-67,6
+78,18
@@
class OneTimeElement(Element):
t = t.encode("utf-8")
stream.write(t)
t = t.encode("utf-8")
stream.write(t)
+ def execBegin(self):
+ pass
+
+ def execEnd(self):
+ pass
+
+ def onShow(self):
+ pass
+
+ def onHide(self):
+ pass
+
def destroy(self):
pass
def destroy(self):
pass
@@
-235,9
+258,14
@@
class webifHandler(ContentHandler):
def startEntity(self, name):
self.res.append('&' + name + ';');
def startEntity(self, name):
self.res.append('&' + name + ';');
+ def execBegin(self):
+ for screen in self.screens:
+ screen.execBegin()
+
def cleanup(self):
print "screen cleanup!"
for screen in self.screens:
def cleanup(self):
print "screen cleanup!"
for screen in self.screens:
+ screen.execEnd()
screen.doClose()
self.screens = [ ]
screen.doClose()
self.screens = [ ]
@@
-282,6
+310,8
@@
def renderPage(stream, path, req, session):
if isinstance(x, Element):
x.handleCommand(req.args)
if isinstance(x, Element):
x.handleCommand(req.args)
+ handler.execBegin()
+
# now, we have a list with static texts mixed
# with non-static Elements.
# flatten this list, write into the stream.
# now, we have a list with static texts mixed
# with non-static Elements.
# flatten this list, write into the stream.
@@
-296,7
+326,7
@@
def renderPage(stream, path, req, session):
def ping(s):
from twisted.internet import reactor
def ping(s):
from twisted.internet import reactor
- s.write("
PING<br/>
\n");
+ s.write("\n");
reactor.callLater(3, ping, s)
# if we met a "StreamingElement", there is at least one
reactor.callLater(3, ping, s)
# if we met a "StreamingElement", there is at least one
@@
-313,5
+343,5
@@
def renderPage(stream, path, req, session):
# in order to detect disconnected clients.
# i agree that this "ping" sucks terrible, so better be sure to have something
# similar. A "CurrentTime" is fine. Or anything that creates *some* output.
# in order to detect disconnected clients.
# i agree that this "ping" sucks terrible, so better be sure to have something
# similar. A "CurrentTime" is fine. Or anything that creates *some* output.
-
#
ping(stream)
+
ping(stream)
stream.closed_callback = lambda: handler.cleanup()
stream.closed_callback = lambda: handler.cleanup()