6d134de89ff38621664df865a9f08d82973e7f3b
[vuplus_dvbapp-plugin] / 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         #please remove unneeded debugoutpu while commiting #print list
114         
115         listR = []
116         listR.append(list)
117         return listR
118
119     text = property(command)        
120     
121     list = property(command)
122     lut = {"enigmaVersion": 0
123 #           ,"lanDHCP": 1
124  #          ,"lanIP": 2
125   #         ,"lanMask": 3
126    #        ,"lanGW": 4
127     #       ,"lanDNS": 5
128            ,"fpVersion": 1
129            ,"tunerInfo": 2
130            ,"hddInfo": 3
131            ,"serviceName": 4
132            ,"serviceProvider": 5
133            ,"serviceAspect": 6
134            ,"serviceNamespace": 7
135            ,"vPID": 8
136            ,"aPID": 9
137            ,"pcrID": 10
138            ,"pmtPID": 11
139            ,"txtPID": 12
140            ,"tsID": 13
141            ,"onID": 14
142            ,"sid": 15
143            }
144