Merge commit 'origin/bug_112_enable_extensions_manager' into experimental
[enigma2.git] / lib / python / Components / About.py
1 from Tools.Directories import resolveFilename, SCOPE_SYSETC
2 from enigma import getEnigmaVersionString
3
4 class About:
5         def __init__(self):
6                 pass
7
8         def getVersionString(self):
9                 return self.getImageVersionString()
10
11         def getImageVersionString(self):
12                 try:
13                         file = open(resolveFilename(SCOPE_SYSETC, 'image-version'), 'r')
14                         lines = file.readlines()
15                         for x in lines:
16                                 splitted = x.split('=')
17                                 if splitted[0] == "version":
18                                         #     YYYY MM DD hh mm
19                                         #0120 2005 11 29 01 16
20                                         #0123 4567 89 01 23 45
21                                         version = splitted[1]
22                                         image_type = version[0] # 0 = release, 1 = experimental
23                                         major = version[1]
24                                         minor = version[2]
25                                         revision = version[3]
26                                         year = version[4:8]
27                                         month = version[8:10]
28                                         day = version[10:12]
29                                         date = '-'.join((year, month, day))
30                                         if image_type == '0':
31                                                 image_type = "Release"
32                                                 version = '.'.join((major, minor, revision))
33                                                 return ' '.join((image_type, version, date))
34                                         else:
35                                                 image_type = "Experimental"
36                                                 return ' '.join((image_type, date))
37                         file.close()
38                 except IOError:
39                         pass
40
41                 return "unavailable"
42
43         def getEnigmaVersionString(self):
44                 return getEnigmaVersionString()
45
46 about = About()