Update tools.py

This commit is contained in:
gutosie
2022-03-24 09:08:35 +02:00
committed by GitHub
parent 0d10c62528
commit 9a8eb1c92f

View File

@@ -36,7 +36,7 @@ from Tools.Testinout import getTestToTest
from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen from os import system, listdir, mkdir, chdir, getcwd, rename as os_rename, remove as os_remove, popen
from os.path import dirname, isdir, isdir as os_isdir from os.path import dirname, isdir, isdir as os_isdir
from enigma import eTimer from enigma import eTimer
from Plugins.Extensions.NeoBoot.files.stbbranding import fileCheck, getMyUUID, getNeoLocation, getImageNeoBoot, getKernelVersionString, getBoxHostName, getCPUtype, getBoxVuModel, getTunerModel, getCPUSoC, getImageATv, getBoxModelVU, getBoxMacAddres, getMountDiskSTB, getCheckActivateVip, getBoxMacAddres, getChipSetString from Plugins.Extensions.NeoBoot.files.stbbranding import fileCheck, getMyUUID, getNeoLocation, getImageNeoBoot, getKernelVersionString, getBoxHostName, getCPUtype, getBoxVuModel, getTunerModel, getCPUSoC, getImageATv, getBoxModelVU, getBoxMacAddres, getMountDiskSTB, getCheckActivateVip, getBoxMacAddres, getChipSetString, getNeoActivatedtest
from Components.Harddisk import harddiskmanager, getProcMounts from Components.Harddisk import harddiskmanager, getProcMounts
import os import os
import time import time
@@ -52,34 +52,28 @@ neoboot = getNeoLocation()
media = getNeoLocation() media = getNeoLocation()
mediahome = media + '/ImageBoot/' mediahome = media + '/ImageBoot/'
def getDS(): def getDS():
s = getDesktop(0).size() s = getDesktop(0).size()
return (s.width(), s.height()) return (s.width(), s.height())
def isFHD(): def isFHD():
desktopSize = getDS() desktopSize = getDS()
return desktopSize[0] == 1920 return desktopSize[0] == 1920
def isHD(): def isHD():
desktopSize = getDS() desktopSize = getDS()
return desktopSize[0] >= 1280 and desktopSize[0] < 1920 return desktopSize[0] >= 1280 and desktopSize[0] < 1920
def isUHD(): def isUHD():
desktopSize = getDS() desktopSize = getDS()
return desktopSize[0] >= 1920 and desktopSize[0] < 3840 return desktopSize[0] >= 1920 and desktopSize[0] < 3840
def getKernelVersion(): def getKernelVersion():
try: try:
return open('/proc/version', 'r').read().split(' ', 4)[2].split('-', 2)[0] return open('/proc/version', 'r').read().split(' ', 4)[2].split('-', 2)[0]
except: except:
return _('unknown') return _('unknown')
def getCPUtype(): def getCPUtype():
cpu = 'UNKNOWN' cpu = 'UNKNOWN'
if os.path.exists('/proc/cpuinfo'): if os.path.exists('/proc/cpuinfo'):
@@ -92,21 +86,6 @@ def getCPUtype():
cpu = 'MIPS' cpu = 'MIPS'
return cpu return cpu
def getNeoActivatedtest():
neoactivated = 'NEOBOOT MULTIBOOT'
if not fileExists('/.multinfo'):
if getCheckActivateVip() != getBoxMacAddres():
neoactivated = 'Ethernet MAC not found.'
elif not fileExists('/usr/lib/periodon/.kodn'):
neoactivated = 'VIP Pin code missing.'
elif getTestToTest() != UPDATEVERSION :
neoactivated = _('Update %s is available.') % getTestToTest()
else:
if getCheckActivateVip() == getBoxMacAddres() and fileExists('/usr/lib/periodon/.kodn') and getTestToTest() == UPDATEVERSION :
neoactivated = 'NEOBOOT VIP ACTIVATED'
return neoactivated
if os.path.exists('/etc/hostname'): if os.path.exists('/etc/hostname'):
with open('/etc/hostname', 'r') as f: with open('/etc/hostname', 'r') as f:
myboxname = f.readline().strip() myboxname = f.readline().strip()
@@ -122,7 +101,6 @@ if os.path.exists('/proc/stb/info/boxtype'):
boxtype = f.readline().strip() boxtype = f.readline().strip()
f.close() f.close()
class BoundFunction: class BoundFunction:
__module__ = __name__ __module__ = __name__
@@ -133,7 +111,6 @@ class BoundFunction:
def __call__(self): def __call__(self):
self.fnc(*self.args) self.fnc(*self.args)
class MBTools(Screen): class MBTools(Screen):
if isFHD(): if isFHD():
skin = """<screen name="MBTools" position="105,81" size="1720,940" title="Tools"> skin = """<screen name="MBTools" position="105,81" size="1720,940" title="Tools">