added a About window
[enigma2-plugins.git] / webinterface / src / WebComponents / Sources / About.py
1 # Parts of Code and idea  by Homey
2 from enigma import *
3
4 from Components.Sources.Source import Source
5 from Components.Harddisk import Harddisk
6 from Components.NimManager import nimmanager
7 from Components.About import about
8
9 from Tools.DreamboxHardware import getFPVersion
10
11 from ServiceReference import ServiceReference
12 from enigma import iServiceInformation
13
14 from Components.config import config, getConfigListEntry
15
16 class About( Source):
17     
18     def __init__(self, session):
19         Source.__init__(self)
20         self.session = session
21     
22     def handleCommand(self,cmd):
23         self.result = False,"unknown command"
24         
25     def command(self):
26         list = []
27         list.append(_("Enigma v%s") % about.getVersionString()) 
28
29         #Get Network Info
30         def ConvertIP(AddStr):
31             retstr = AddStr.replace(', ','.')
32             retstr = retstr.replace('[','')
33             retstr = retstr.replace(']','')
34             return retstr
35
36         list.append(_("Use DHCP %s") % config.network.dhcp.value)
37         list.append(ConvertIP(_("IP Address %s") % config.network.ip.value))
38         list.append(ConvertIP(_("Netmask %s") % config.network.netmask.value))
39         list.append(ConvertIP(_("Gateway %s") % config.network.gateway.value))
40         list.append(ConvertIP(_("Nameserver %s") % config.network.dns.value))
41
42         #Get FrontProcessor Version
43         fp_version = getFPVersion()
44         if fp_version is None:
45             fp_version = "?"
46         else:
47             fp_version = _("Frontprocessor version: %d") % fp_version
48         list.append(fp_version)
49
50         #Get Tuner Info
51         nims = nimmanager.nimList()
52         tunerA = nims[0][0]
53         tunerB = nims[1][0]
54         list.append(_("Detected NIMs: </br>%s</br>%s") % (tunerA,tunerB))
55
56         #Get HDD Info
57         hdddata = Harddisk(0)
58         if hdddata.model() != "":
59             hddinfo = _("Detected HDD: </br>%s (%s, %d MB free)") % (hdddata.model(), hdddata.capacity(),hdddata.free())
60         else:            
61             hddinfo = "None"
62         list.append(hddinfo)
63
64         #Get Service Info
65         service = self.session.nav.getCurrentService()
66
67         if self.session.nav.getCurrentlyPlayingServiceReference() is not None:
68             Name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
69         else:
70             Name = "N/A"
71         list.append(Name)
72
73         if service is not None:
74             svinfo = service.info()
75             svfeinfo = service.frontendInfo()
76         else:
77             svinfo = None
78             svfeinfo = None
79
80         # Get Service Info
81         list.append(svinfo.getInfoString(iServiceInformation.sProvider))
82         list.append(svinfo.getInfo(iServiceInformation.sAspect))
83         list.append(hex(svinfo.getInfo(iServiceInformation.sNamespace)))
84
85         # Get PIDs
86         list.append(svinfo.getInfo(iServiceInformation.sVideoPID))
87         list.append(svinfo.getInfo(iServiceInformation.sAudioPID))
88         list.append(svinfo.getInfo(iServiceInformation.sPCRPID))
89         list.append(svinfo.getInfo(iServiceInformation.sPMTPID))
90         list.append(svinfo.getInfo(iServiceInformation.sTXTPID))
91         list.append(svinfo.getInfo(iServiceInformation.sTSID))
92         list.append(svinfo.getInfo(iServiceInformation.sONID))
93         list.append(svinfo.getInfo(iServiceInformation.sSID))
94         print list
95         
96         listR = []
97         listR.append(list)
98         return listR
99
100     text = property(command)        
101     
102     list = property(command)
103     lut = {"enigmaVersion": 0
104            ,"lanDHCP": 1
105            ,"lanIP": 2
106            ,"lanMask": 3
107            ,"lanGW": 4
108            ,"lanDNS": 5
109            ,"fpVersion": 6
110            ,"tunerInfo": 7
111            ,"hddInfo": 8
112            ,"serviceName": 9
113            ,"serviceProvider": 10
114            ,"serviceAspect": 11
115            ,"serviceNamespace": 12
116            ,"vPID": 13
117            ,"aPID": 14
118            ,"pcrID": 15
119            ,"pmtPID": 16
120            ,"txtPID": 17
121            ,"tsID": 18
122            ,"onID": 19
123            ,"sid": 20
124            }
125