moved Version-Tag out of pagetitle into About
[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(about.getVersionString()) 
28
29 #===============================================================================
30 #        #Get Network Info
31 #        def ConvertIP(AddStr):
32 #            retstr = AddStr.replace(', ','.')
33 #            retstr = retstr.replace('[','')
34 #            retstr = retstr.replace(']','')
35 #            return retstr
36
37 #        list.append(_("Use DHCP %s") % config.network.dhcp.value)
38 #        list.append(ConvertIP(_("IP Address %s") % config.network.ip.value))
39 #        list.append(ConvertIP(_("Netmask %s") % config.network.netmask.value))
40 #        list.append(ConvertIP(_("Gateway %s") % config.network.gateway.value))
41 #        list.append(ConvertIP(_("Nameserver %s") % config.network.dns.value))
42 #===============================================================================
43
44         #Get FrontProcessor Version
45         fp_version = getFPVersion()
46         if fp_version is None:
47             fp_version = "?"
48         else:
49             fp_version = str(fp_version)
50         list.append(fp_version)
51
52         #Get Tuner Info
53         niminfo = ""
54         for nim in nimmanager.nimList():
55             niminfo += "<e2nim>"+nim+"</e2nim>"
56         list.append(niminfo)
57
58         #Get HDD Info
59         hdddata = Harddisk(0)
60         if hdddata.model() != "":
61             hddinfo = "<model>"+hdddata.model()+"</model>"
62             hddinfo += "<capacity>"+hdddata.capacity()+"</capacity>"
63             hddinfo += "<free>"+str(hdddata.free())+" MB</free>"
64             
65         else:            
66             hddinfo = "no harddisc detected"
67         list.append(hddinfo)
68
69         #Get Service Info
70         service = self.session.nav.getCurrentService()
71
72         if self.session.nav.getCurrentlyPlayingServiceReference() is not None:
73             Name = ServiceReference(self.session.nav.getCurrentlyPlayingServiceReference()).getServiceName()
74         else:
75             Name = "N/A"
76         list.append(Name)
77
78         if service is not None:
79             svinfo = service.info()
80             svfeinfo = service.frontendInfo()
81         else:
82             svinfo = None
83             svfeinfo = None
84
85         # Get Service Info
86         if svinfo is not None:
87             list.append(svinfo.getInfoString(iServiceInformation.sProvider))
88             list.append(svinfo.getInfo(iServiceInformation.sAspect))
89             list.append(hex(svinfo.getInfo(iServiceInformation.sNamespace)))
90
91             # Get PIDs
92             list.append(svinfo.getInfo(iServiceInformation.sVideoPID))
93             list.append(svinfo.getInfo(iServiceInformation.sAudioPID))
94             list.append(svinfo.getInfo(iServiceInformation.sPCRPID))
95             list.append(svinfo.getInfo(iServiceInformation.sPMTPID))
96             list.append(svinfo.getInfo(iServiceInformation.sTXTPID))
97             list.append(svinfo.getInfo(iServiceInformation.sTSID))
98             list.append(svinfo.getInfo(iServiceInformation.sONID))
99             list.append(svinfo.getInfo(iServiceInformation.sSID))
100         else:
101             list.append("N/A")
102             list.append("N/A")
103             list.append("N/A")
104             list.append("N/A")
105             list.append("N/A")
106             list.append("N/A")
107             list.append("N/A")
108             list.append("N/A")
109             list.append("N/A")
110             list.append("N/A")
111             list.append("N/A")
112             
113         ## webifversion
114         list.append(config.plugins.Webinterface.version.value)
115         
116         #please remove unneeded debugoutpu while commiting #print list
117         
118         listR = []
119         listR.append(list)
120         
121         return listR
122
123     text = property(command)        
124     
125     list = property(command)
126     lut = {"enigmaVersion": 0
127 #           ,"lanDHCP": 1
128  #          ,"lanIP": 2
129   #         ,"lanMask": 3
130    #        ,"lanGW": 4
131     #       ,"lanDNS": 5
132            ,"fpVersion": 1
133            ,"tunerInfo": 2
134            ,"hddInfo": 3
135            ,"serviceName": 4
136            ,"serviceProvider": 5
137            ,"serviceAspect": 6
138            ,"serviceNamespace": 7
139            ,"vPID": 8
140            ,"aPID": 9
141            ,"pcrID": 10
142            ,"pmtPID": 11
143            ,"txtPID": 12
144            ,"tsID": 13
145            ,"onID": 14
146            ,"sid": 15
147            ,"WebIfVersion": 16
148            }
149