don't use devfs names: /dev/i2c/X -> /dev/i2c-X
[enigma2.git] / lib / python / Components / About.py
old mode 100644 (file)
new mode 100755 (executable)
index 6317af7..6b322c9
@@ -1,10 +1,15 @@
-from Tools.Directories import *
+from Tools.Directories import resolveFilename, SCOPE_SYSETC
+from enigma import getEnigmaVersionString
+from os import popen
 
 class About:
        def __init__(self):
                pass
 
 class About:
        def __init__(self):
                pass
-       
+
        def getVersionString(self):
        def getVersionString(self):
+               return self.getImageVersionString()
+
+       def getImageVersionString(self):
                try:
                        file = open(resolveFilename(SCOPE_SYSETC, 'image-version'), 'r')
                        lines = file.readlines()
                try:
                        file = open(resolveFilename(SCOPE_SYSETC, 'image-version'), 'r')
                        lines = file.readlines()
@@ -15,15 +20,38 @@ class About:
                                        #0120 2005 11 29 01 16
                                        #0123 4567 89 01 23 45
                                        version = splitted[1]
                                        #0120 2005 11 29 01 16
                                        #0123 4567 89 01 23 45
                                        version = splitted[1]
+                                       image_type = version[0] # 0 = release, 1 = experimental
+                                       major = version[1]
+                                       minor = version[2]
+                                       revision = version[3]
                                        year = version[4:8]
                                        month = version[8:10]
                                        day = version[10:12]
                                        year = version[4:8]
                                        month = version[8:10]
                                        day = version[10:12]
-                                       
-                                       return '-'.join(["2.0", year, month, day])
+                                       date = '-'.join((year, month, day))
+                                       if image_type == '0':
+                                               image_type = "Release"
+                                               version = '.'.join((major, minor, revision))
+                                               return ' '.join((image_type, version, date))
+                                       else:
+                                               image_type = "Experimental"
+                                               return ' '.join((image_type, date))
                        file.close()
                except IOError:
                        pass
 
                return "unavailable"
                        file.close()
                except IOError:
                        pass
 
                return "unavailable"
-       
+
+       def getEnigmaVersionString(self):
+               return getEnigmaVersionString()
+
+       def getKernelVersionString(self):
+               try:
+                       result = popen("uname -r","r").read().strip("\n").split('-')
+                       kernel_version = result[0]
+                       return kernel_version
+               except:
+                       pass
+
+               return "unknown"
+
 about = About()
 about = About()