TransCodingSetup : set defalut bitrate of SOLO2
[vuplus_dvbapp] / lib / python / Plugins / SystemPlugins / TransCodingSetup / plugin.py
index ec832bb..7a744ae 100755 (executable)
@@ -47,6 +47,15 @@ class TranscodingSetupInit:
                        if fileExists(x[1]):
                                TranscodingConfigList.append(x)
 
+       def getModel(self):
+               if fileExists("/proc/stb/info/vumodel"):
+                       fd = open("/proc/stb/info/vumodel")
+                       vumodel=fd.read().strip()
+                       fd.close()
+                       return vumodel
+               else:
+                       return False
+
        def createConfig(self):
                config.plugins.transcodingsetup = ConfigSubsection()
                config.plugins.transcodingsetup.transcoding = ConfigSelection(default = "disable", choices = [ ("enable", _("enable")), ("disable", _("disable"))] )
@@ -54,7 +63,11 @@ class TranscodingSetupInit:
                global TranscodingConfigList
                for x in TranscodingConfigList:
                        if x[0] == "Bitrate":
-                               config.plugins.transcodingsetup.bitrate = ConfigInteger(default = 2000000, limits = (100000, 5000000))
+                               if self.getModel() == "solo2":
+                                       default_bitrate = 400000
+                               else:
+                                       default_bitrate = 2000000
+                               config.plugins.transcodingsetup.bitrate = ConfigInteger(default = default_bitrate, limits = (100000, 5000000))
                                x.append(config.plugins.transcodingsetup.bitrate)
                        elif x[0] == "Framerate":
                                config.plugins.transcodingsetup.framerate = ConfigSelection(default = "30000", choices = [ ("23976", _("23976")), ("24000", _("24000")), ("29970", _("29970")), ("30000", _("30000")), ("59940", _("59940")), ("60000", _("60000"))])
@@ -62,7 +75,7 @@ class TranscodingSetupInit:
 
        def setTranscoding(self, transcoding, port):
                if transcoding not in ["enable","disable"] or port not in ["8001","8002"]:
-                       print "Input error."
+#                      print "Input error."
                        return -7
                if not fileExists("/proc/stb/encoder/enable"):
                        return -1
@@ -82,7 +95,7 @@ class TranscodingSetupInit:
                return res
 
        def setEncoderEnable(self,mode = "disable"):
-               print "<TranscodingSetup> set encoder %s" % mode
+#              print "<TranscodingSetup> set encoder %s" % mode
                mode = mode.strip(' ').strip('\n')
                try:
                        fd = open("/proc/stb/encoder/enable",'r')
@@ -104,7 +117,7 @@ class TranscodingSetupInit:
                        return -1
 
        def setPort(self, port = "8001"):
-               print "<TranscodingSetup> set port %s" % port
+#              print "<TranscodingSetup> set port %s" % port
                try:
                        fp = file('/etc/inetd.conf', 'r')
                        datas = fp.readlines()
@@ -140,6 +153,8 @@ class TranscodingSetupInit:
        def inetdRestart(self):
                if fileExists("/etc/init.d/inetd"):
                        os_system("/etc/init.d/inetd restart")
+               elif fileExists("/etc/init.d/inetd.busybox"):
+                       os_system("/etc/init.d/inetd.busybox restart")
 
        def setEncoderExtra(self):
                global TranscodingConfigList
@@ -149,7 +164,7 @@ class TranscodingSetupInit:
                return 0
 
        def setEncoder(self, procPath, value):
-               print "<TranscodingSetup> set %s "%procPath, value
+#              print "<TranscodingSetup> set %s "%procPath, value
                if not fileExists(procPath):
                        return -1
                if isinstance(value, str):
@@ -161,6 +176,7 @@ class TranscodingSetupInit:
                        old_value = fd.read().strip(' ').strip('\n')
                        fd.close()
                        if old_value != value:
+                               print "<TranscodingSetup> set %s "%procPath, value
                                fd = open(procPath,'w')
                                fd.write(value)
                                fd.close()