add possibility to choose the finished timer timerlist position in usage config
[enigma2.git] / lib / python / Components / About.py
1 from Tools.Directories import resolveFilename, SCOPE_SYSETC
2 from enigma import getEnigmaVersionString
3 from os import popen
4
5 class About:
6         def __init__(self):
7                 pass
8
9         def getVersionString(self):
10                 return self.getImageVersionString()
11
12         def getImageVersionString(self):
13                 try:
14                         file = open(resolveFilename(SCOPE_SYSETC, 'image-version'), 'r')
15                         lines = file.readlines()
16                         for x in lines:
17                                 splitted = x.split('=')
18                                 if splitted[0] == "version":
19                                         #     YYYY MM DD hh mm
20                                         #0120 2005 11 29 01 16
21                                         #0123 4567 89 01 23 45
22                                         version = splitted[1]
23                                         image_type = version[0] # 0 = release, 1 = experimental
24                                         major = version[1]
25                                         minor = version[2]
26                                         revision = version[3]
27                                         year = version[4:8]
28                                         month = version[8:10]
29                                         day = version[10:12]
30                                         date = '-'.join((year, month, day))
31                                         if image_type == '0':
32                                                 image_type = "Release"
33                                                 version = '.'.join((major, minor, revision))
34                                                 return ' '.join((image_type, version, date))
35                                         else:
36                                                 image_type = "Experimental"
37                                                 return ' '.join((image_type, date))
38                         file.close()
39                 except IOError:
40                         pass
41
42                 return "unavailable"
43
44         def getEnigmaVersionString(self):
45                 return getEnigmaVersionString()
46
47         def getKernelVersionString(self):
48                 try:
49                         result = popen("uname -r","r").read().strip("\n").split('-')
50                         kernel_version = result[0]
51                         return kernel_version
52                 except:
53                         pass
54
55                 return "unknown"
56
57 about = About()