Intital CVS Version by 3c5x9
authorRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Tue, 9 Jan 2007 22:38:25 +0000 (22:38 +0000)
committerRico Schulte <ricoschulte@users.schwerkraft.elitedvb.net>
Tue, 9 Jan 2007 22:38:25 +0000 (22:38 +0000)
webinterface/src/usr/lib/enigma2/python/Components/Converter/.cvsignore [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Components/Converter/EPGToText.py [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Components/Converter/VolumeToText.py [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Components/Sources/EPG.py [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Components/Sources/Volume.py [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgnownext.xml [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgsearch.xml [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgservice.xml [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/fetchchannels.xml [new file with mode: 0644]
webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/vol.xml [new file with mode: 0644]

diff --git a/webinterface/src/usr/lib/enigma2/python/Components/Converter/.cvsignore b/webinterface/src/usr/lib/enigma2/python/Components/Converter/.cvsignore
new file mode 100644 (file)
index 0000000..52e4e61
--- /dev/null
@@ -0,0 +1,2 @@
+*.pyc
+*.pyo
diff --git a/webinterface/src/usr/lib/enigma2/python/Components/Converter/EPGToText.py b/webinterface/src/usr/lib/enigma2/python/Components/Converter/EPGToText.py
new file mode 100644 (file)
index 0000000..7c65d6f
--- /dev/null
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+from Converter import Converter
+from xml.dom.minidom import Document
+class EPGToText(Converter, object):
+    
+    def __init__(self, type):
+        Converter.__init__(self, type)
+        print "Converter.EPGToText type=",type
+        self.type = type
+    def getHTML(self,value):
+        print "Converter.getHTML value=",value       
+        return self.getText();
+    def getText(self):
+        if self.type == "search":
+            return self.EPGListToXML(self.source.searchEvent())
+        elif self.type == "service":
+            return self.EPGListToXML(self.source.getEPGofService())
+        elif self.type == "nownext":
+            return self.EPGListToXML(self.source.getEPGNowNext())
+        else:
+            return "unknown type ",type
+    def EPGListToXML(self,epglist):
+        if epglist :
+            xmlDocument = Document()
+            rootNode = xmlDocument.createElement('EPGList')
+            for row in epglist:
+                itemnode = xmlDocument.createElement('EPGEvent')
+                for key, val in row.items():
+                        keynode = xmlDocument.createElement(key)
+                        textnode = xmlDocument.createTextNode(val)
+                        keynode.appendChild(textnode)
+                        itemnode.appendChild(keynode);
+                rootNode.appendChild(itemnode)
+                xmlDocument.appendChild(rootNode)
+            return xmlDocument.toxml()
+        else:
+            return "no data"
+            
+    text = property(getText,getHTML)
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Components/Converter/VolumeToText.py b/webinterface/src/usr/lib/enigma2/python/Components/Converter/VolumeToText.py
new file mode 100644 (file)
index 0000000..b06f75e
--- /dev/null
@@ -0,0 +1,21 @@
+from Converter import Converter
+from Components.config import *
+from enigma import eDVBVolumecontrol #this is not nice
+class VolumeToText(Converter, object):
+    
+    def __init__(self, type):
+        Converter.__init__(self, type)
+        self.volctrl = eDVBVolumecontrol.getInstance() # this is not nice
+        
+    def getHTML(self, id):
+        return self.getText() # encode & etc. here!
+    def getText(self):
+        r = "%s\n"%config.audio.volume.value
+        if self.volctrl.isMuted():
+            r+="muted"
+        else:
+            r+="notmuted"
+        return r
+        
+
+    text = property(getText)
diff --git a/webinterface/src/usr/lib/enigma2/python/Components/Sources/EPG.py b/webinterface/src/usr/lib/enigma2/python/Components/Sources/EPG.py
new file mode 100644 (file)
index 0000000..12f0267
--- /dev/null
@@ -0,0 +1,57 @@
+from enigma import *
+
+from Source import Source
+from ServiceReference import ServiceReference
+
+class EPG( Source):
+    def __init__(self, navcore):
+        Source.__init__(self)
+        self.navcore = navcore
+        self.epgcache = eEPGCache.getInstance()
+    def handleCommand(self,cmd):
+        print "EPG.handleCommand %s" %cmd   
+        self.command = cmd
+
+    def getEPGNowNext(self):
+        print "getting EPG of Service ",self.command
+        events = self.epgcache.lookupEvent(['IBDTSERN',(self.command,0,0,-1)]);
+        if events:
+                return self.convertToDictonary(events[:2])
+        else:
+                return False
+    
+    def getEPGofService(self):
+        print "getting EPG of Service ",self.command
+        events = self.epgcache.lookupEvent(['IBDTSERN',(self.command,0,-1,-1)]);
+        if events:
+                return self.convertToDictonary(events)
+        else:
+                return False
+    
+    def searchEvent(self):
+        print "searchEvent",self.command
+        events = self.epgcache.search(('IBDTSERN',1024,eEPGCache.PARTIAL_TITLE_SEARCH,self.command,1));
+        if events:
+            return self.convertToDictonary(events)
+        else:
+            return False
+    def convertToDictonary(self,EventList):
+        result=[]
+        for x in EventList:
+            row = {}                        
+            row['EventID']=self.convertIfEmpty(x[0])
+            row['TimeStart']=self.convertIfEmpty(x[1])
+            row['Duration']=self.convertIfEmpty(x[2])
+            row['Title']=self.convertIfEmpty(x[3])
+            row['Description']=self.convertIfEmpty(x[4])
+            row['DescriptionExtended']=self.convertIfEmpty(x[5])
+            row['ServiceReference']=self.convertIfEmpty(x[6])
+            row['ServiceName']=self.convertIfEmpty(x[7])
+            result.append(row)                                    
+        return result
+    def convertIfEmpty(self,string):
+        if string == "":
+            return "N/A"
+        else:
+            return string.__str__()
+    epg = property(searchEvent,getEPGofService,getEPGNowNext)    
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Components/Sources/Volume.py b/webinterface/src/usr/lib/enigma2/python/Components/Sources/Volume.py
new file mode 100644 (file)
index 0000000..7d8d5fe
--- /dev/null
@@ -0,0 +1,23 @@
+from Source import Source
+from GlobalActions import globalActionMap
+
+from time import time
+
+class Volume( Source):
+    def __init__(self, navcore):
+        Source.__init__(self)
+        
+        
+    def handleCommand(self, cmd):
+        global globalActionMap
+        if cmd == "up":
+            globalActionMap.actions["volumeUp"]()
+        elif cmd == "down":
+            globalActionMap.actions["volumeDown"]()
+        elif cmd == "mute":
+            globalActionMap.actions["volumeMute"]()
+        elif cmd == "value":
+            pass 
+        else:
+            print "unknow Volume handle command",cmd
+        
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgnownext.xml b/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgnownext.xml
new file mode 100644 (file)
index 0000000..8b5f68d
--- /dev/null
@@ -0,0 +1 @@
+<e2:screen name="TestScreen"><e2:element source="EPG" id="serviceRef"><e2:convert type="EPGToText">nownext</e2:convert></e2:element></e2:screen>
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgsearch.xml b/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgsearch.xml
new file mode 100644 (file)
index 0000000..b275395
--- /dev/null
@@ -0,0 +1 @@
+<e2:screen name="TestScreen"><e2:element source="EPG" id="search"><e2:convert type="EPGToText">search</e2:convert></e2:element></e2:screen>
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgservice.xml b/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/epgservice.xml
new file mode 100644 (file)
index 0000000..2146132
--- /dev/null
@@ -0,0 +1 @@
+<e2:screen name="TestScreen"><e2:element source="EPG" id="serviceRef"><e2:convert type="EPGToText">service</e2:convert></e2:element></e2:screen>
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/fetchchannels.xml b/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/fetchchannels.xml
new file mode 100644 (file)
index 0000000..6e46785
--- /dev/null
@@ -0,0 +1,7 @@
+<e2:screen name="TestScreen"><e2:element source="ServiceListBrowse">
+<e2:convert type="web:ListFiller"><e2:item name="Reference" />
+<e2:item name="Name"/>
+</e2:convert>
+  <e2:convert type="web:TextToHTML" />
+</e2:element>
+</e2:screen>
\ No newline at end of file
diff --git a/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/vol.xml b/webinterface/src/usr/lib/enigma2/python/Plugins/Extensions/WebInterface/web/vol.xml
new file mode 100644 (file)
index 0000000..fb8d463
--- /dev/null
@@ -0,0 +1,5 @@
+<e2:screen name="TestScreen">
+<e2:element source="Volume" id="set">
+<e2:convert type="VolumeToText">CurrentVolume</e2:convert>
+</e2:element>
+</e2:screen>