Skip to content

Commit

Permalink
Merge branch 'Developer' into Python3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
Ev0-BH committed Dec 31, 2023
2 parents 9e5d8bb + 54db503 commit a8dc68f
Show file tree
Hide file tree
Showing 47 changed files with 421 additions and 411 deletions.
29 changes: 29 additions & 0 deletions doc/BOXINFO_BOXBRANDING
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
getBoxType = boxtype (only in OpenBh)
getBrandOEM = brand
getDisplayType = displaytype
getHaveAVJACK = avjack
getHaveHDMIinFHD = hdmifhdin
getHaveHDMIinHD = hdmihdin
getHaveRCA = rca
getHaveSCART = scart
getHaveSCARTYUV = scartyuv
getHaveYUV = yuv
getImageType = imagetype
getMachineBrand = displaybrand
getMachineBuild = model
getMachineMtdRoot = mtdrootfs
getMachineName = machinename (only in OpenBh) or MachineName
getDriverDate = driversdate
getImageDistro = distro
getDisplayType = displaytype
getFeedsUrl = feedsurl
getImageBuild = imagebuild
getImageVersion = imageversion
getMachineMake = machinebuild
getImageDevBuild = imagedevbuild
getImageFolder = imagedir
getImageFileSystem = imagefs
getMachineMtdKernel = mtdkernel
getMachineKernelFile = kernelfile
getMachineUBINIZE = ubinize
getMachineMKUBIFS = mkubifs
10 changes: 3 additions & 7 deletions lib/python/Components/AVSwitch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from os import path

from enigma import eAVSwitch, getDesktop
from boxbranding import getBoxType, getBrandOEM

from Components.config import ConfigBoolean, ConfigEnableDisable, ConfigNothing, ConfigSelection, ConfigSelectionNumber, ConfigSlider, ConfigSubDict, ConfigSubsection, ConfigYesNo, NoSave, config
from Components.SystemInfo import SystemInfo
Expand Down Expand Up @@ -143,7 +142,7 @@ def setMode(self, port, mode, rate, force=None):
except (IOError, OSError):
print("[AVSwitch] cannot open /proc/stb/video/videomode_24hz")

if getBrandOEM() in ("gigablue",):
if SystemInfo["brand"] in ("gigablue",):
try:
# use 50Hz mode (if available) for booting
with open("/etc/videomode", "w") as fd:
Expand Down Expand Up @@ -492,7 +491,7 @@ def setEDIDBypass(configElement):
if SystemInfo["havecolorspace"]:
def setHDMIColorspace(configElement):
open(SystemInfo["havecolorspace"], "w").write(configElement.value)
if getBrandOEM() == "vuplus" and SystemInfo["HasMMC"]:
if SystemInfo["brand"] == "vuplus" and SystemInfo["HasMMC"]:
choices = [
("Edid(Auto)", _("Auto")),
("Hdmi_Rgb", _("RGB")),
Expand Down Expand Up @@ -869,10 +868,7 @@ def setScaler_sharpness(configElement):
open("/proc/stb/vmpeg/0/pep_apply", "w").write("1")
except (IOError, OSError):
print("[AVSwitch] couldn't write pep_scaler_sharpness")
if getBoxType() in ("gbquad", "gbquadplus"):
config.av.scaler_sharpness = ConfigSlider(default=5, limits=(0, 26))
else:
config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0, 26))
config.av.scaler_sharpness = ConfigSlider(default=13, limits=(0, 26))
config.av.scaler_sharpness.addNotifier(setScaler_sharpness)
else:
config.av.scaler_sharpness = NoSave(ConfigNothing())
Expand Down
14 changes: 8 additions & 6 deletions lib/python/Components/About.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
import fcntl
import struct

from boxbranding import getDriverDate, getImageVersion, getMachineBuild, getBoxType

from enigma import getEnigmaVersionString


def getVersionString():
return getImageVersion()
from Components.SystemInfo import SystemInfo
return SystemInfo["imageversion"]


def getFlashDateString():
Expand All @@ -23,7 +22,8 @@ def getFlashDateString():


def driversDate():
return _formatDate(getDriverDate())
from Components.SystemInfo import SystemInfo
return _formatDate(SystemInfo["driversdate"])


def getLastUpdate():
Expand Down Expand Up @@ -84,7 +84,8 @@ def getCPUSpeedMHzInt():
print("[About] getCPUSpeedMHzInt, /proc/cpuinfo not available")

if cpu_speed == 0:
if getMachineBuild() in ("h7", "hd51", "sf4008", "osmio4k", "osmio4kplus", "osmini4k"):
from Components.SystemInfo import MODEL
if MODEL in ("h7", "sf4008", "osmio4k", "osmio4kplus", "osmini4k"):
try:
import binascii
with open("/sys/firmware/devicetree/base/cpus/cpu@0/clock-frequency", "rb") as f:
Expand Down Expand Up @@ -115,7 +116,8 @@ def getCPUSpeedString():


def getCPUArch():
if getBoxType() in ("osmio4k", ):
from Components.SystemInfo import MODEL
if MODEL.startswith("osmio4k"):
return "ARM V7"
if "ARM" in getCPUString():
return getCPUString()
Expand Down
8 changes: 1 addition & 7 deletions lib/python/Components/FanControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import NavigationInstance
from enigma import iRecordableService
from boxbranding import getBoxType


class FanControl:
Expand Down Expand Up @@ -66,12 +65,7 @@ def setPWM(fancontrol, fanid, configElement):
for fanid in range(self.getFanCount()):
fan = ConfigSubsection()
fan.vlt = ConfigSlider(default=15, increment=5, limits=(0, 255))
if getBoxType() == 'tm2t':
fan.pwm = ConfigSlider(default=150, increment=5, limits=(0, 255))
if getBoxType() == 'tmsingle':
fan.pwm = ConfigSlider(default=100, increment=5, limits=(0, 255))
else:
fan.pwm = ConfigSlider(default=50, increment=5, limits=(0, 255))
fan.pwm = ConfigSlider(default=50, increment=5, limits=(0, 255))
fan.vlt_standby = ConfigSlider(default=5, increment=5, limits=(0, 255))
fan.pwm_standby = ConfigSlider(default=0, increment=5, limits=(0, 255))
fan.vlt.addNotifier(boundFunction(setVlt, self, fanid))
Expand Down
4 changes: 2 additions & 2 deletions lib/python/Components/InputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from enigma import eRCInput
from keyids import KEYIDNAMES

from boxbranding import getBrandOEM
from Components.SystemInfo import SystemInfo
from Components.config import config, ConfigInteger, ConfigSlider, ConfigSubsection, ConfigText, ConfigYesNo
from Screens.Rc import RcPositions

Expand Down Expand Up @@ -215,7 +215,7 @@ def remapRemoteControl(self, device):
class RcTypeControl():
def __init__(self):
self.boxType = "Default"
if path.exists('/proc/stb/ir/rc/type') and path.exists('/proc/stb/info/boxtype') and getBrandOEM() != 'gigablue':
if path.exists('/proc/stb/ir/rc/type') and path.exists('/proc/stb/info/boxtype') and SystemInfo["brand"] != 'gigablue':
self.isSupported = True
with open("/proc/stb/info/boxtype", "r") as fd:
self.boxType = fd.read().strip()
Expand Down
4 changes: 2 additions & 2 deletions lib/python/Components/Ipkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from enigma import eConsoleAppContainer
from Components.Harddisk import harddiskmanager
from Tools.Directories import resolveFilename, SCOPE_LIBDIR
from boxbranding import getImageDistro
from Components.SystemInfo import SystemInfo

opkgDestinations = []
opkgStatusPath = ''
Expand Down Expand Up @@ -90,7 +90,7 @@ def runCmd(self, cmd):
def startCmd(self, cmd, args=None):
if cmd == self.CMD_UPDATE:
for fn in listdir('/var/lib/opkg'):
if fn.startswith(getImageDistro()):
if fn.startswith(SystemInfo["distro"]):
remove('/var/lib/opkg/' + fn)
self.runCmdEx("update")
elif cmd == self.CMD_UPGRADE:
Expand Down
16 changes: 7 additions & 9 deletions lib/python/Components/Lcd.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from sys import maxsize

from boxbranding import getBoxType, getDisplayType

from enigma import eDBoxLCD, eTimer, eActionMap

from Components.config import config, ConfigSubsection, ConfigSelection, ConfigSlider, ConfigYesNo, ConfigNothing
Expand Down Expand Up @@ -179,7 +177,7 @@ def standbyCounterChanged(dummy):
def InitLcd():
if SystemInfo["HasNoDisplay"]:
detected = False
elif getBoxType() in ('gbtrio4k',):
elif SystemInfo["boxtype"] in ('gbtrio4k',):
detected = True
else:
detected = eDBoxLCD.getInstance().detected()
Expand Down Expand Up @@ -420,14 +418,14 @@ def lcdLiveTvChanged(configElement):
if "live_enable" in SystemInfo["LcdLiveTV"]:
config.misc.standbyCounter.addNotifier(standbyCounterChangedLCDLiveTV, initial_call=False)

if SystemInfo["LCDMiniTV"] and getBoxType() not in ('gbquad4k', 'gbue4k'):
if SystemInfo["LCDMiniTV"] and SystemInfo["boxtype"] not in ('gbquad4k', 'gbue4k'):
config.lcd.minitvmode = ConfigSelection([("0", _("normal")), ("1", _("MiniTV")), ("2", _("OSD")), ("3", _("MiniTV with OSD"))], "0")
config.lcd.minitvmode.addNotifier(setLCDminitvmode)
config.lcd.minitvpipmode = ConfigSelection([("0", _("off")), ("5", _("PIP")), ("7", _("PIP with OSD"))], "0")
config.lcd.minitvpipmode.addNotifier(setLCDminitvpipmode)
config.lcd.minitvfps = ConfigSlider(default=30, limits=(0, 30))
config.lcd.minitvfps.addNotifier(setLCDminitvfps)
elif can_lcdmodechecking and getBoxType() in ('gbquad4k', 'gbue4k'):
elif can_lcdmodechecking and SystemInfo["boxtype"] in ('gbquad4k', 'gbue4k'):
# (0:normal, 1:video0, 2:fb, 3:vide0+fb, 4:video1, 5:vide0+video1, 6:video1+fb, 7:video0+video1+fb)
config.lcd.minitvmode = ConfigSelection(default="0", choices=[
("0", _("normal")),
Expand All @@ -451,20 +449,20 @@ def lcdLiveTvChanged(configElement):
config.lcd.minitvpipmode = ConfigNothing()
config.lcd.minitvfps = ConfigNothing()

if SystemInfo["VFD_scroll_repeats"] and getDisplayType() not in ('7segment'):
if SystemInfo["VFD_scroll_repeats"] and SystemInfo["displaytype"] not in ('7segment'):
def scroll_repeats(el):
open(SystemInfo["VFD_scroll_repeats"], "w").write(el.value)
choicelist = [("0", _("None")), ("1", _("1X")), ("2", _("2X")), ("3", _("3X")), ("4", _("4X")), ("500", _("Continues"))]
config.usage.vfd_scroll_repeats = ConfigSelection(default="3", choices=choicelist)
config.usage.vfd_scroll_repeats.addNotifier(scroll_repeats, immediate_feedback=False)

if SystemInfo["VFD_scroll_delay"] and getDisplayType() not in ('7segment'):
if SystemInfo["VFD_scroll_delay"] and SystemInfo["displaytype"] not in ('7segment'):
def scroll_delay(el):
open(SystemInfo["VFD_scroll_delay"], "w").write(str(el.value))
config.usage.vfd_scroll_delay = ConfigSlider(default=150, increment=10, limits=(0, 500))
config.usage.vfd_scroll_delay.addNotifier(scroll_delay, immediate_feedback=False)

if SystemInfo["VFD_initial_scroll_delay"] and getDisplayType() not in ('7segment'):
if SystemInfo["VFD_initial_scroll_delay"] and SystemInfo["displaytype"] not in ('7segment'):
def initial_scroll_delay(el):
open(SystemInfo["VFD_initial_scroll_delay"], "w").write(el.value)
choicelist = [
Expand All @@ -475,7 +473,7 @@ def initial_scroll_delay(el):
config.usage.vfd_initial_scroll_delay = ConfigSelection(default="1000", choices=choicelist)
config.usage.vfd_initial_scroll_delay.addNotifier(initial_scroll_delay, immediate_feedback=False)

if SystemInfo["VFD_final_scroll_delay"] and getDisplayType() not in ('7segment'):
if SystemInfo["VFD_final_scroll_delay"] and SystemInfo["displaytype"] not in ('7segment'):
def final_scroll_delay(el):
open(SystemInfo["VFD_final_scroll_delay"], "w").write(el.value)
choicelist = [
Expand Down
28 changes: 14 additions & 14 deletions lib/python/Components/OnlineUpdateCheck.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from time import time

from boxbranding import getImageVersion, getImageBuild, getMachineBrand, getMachineName, getMachineBuild, getImageType, getBoxType, getFeedsUrl
from enigma import eTimer
from Components.About import about
from Components.config import config
from Components.Ipkg import IpkgComponent
from Components.SystemInfo import SystemInfo
import Components.Task

import socket
Expand Down Expand Up @@ -80,7 +80,7 @@ def getFeedStatus(self):
trafficLight = "stable"
if self.adapterAvailable():
if self.NetworkUp():
if getImageType() == "release" and officialReleaseFeedsUri in getFeedsUrl(): # we know the network is good now so only do this check on release images where the release domain applies
if SystemInfo["imagetype"] == "release" and officialReleaseFeedsUri in SystemInfo["feedsurl"]: # we know the network is good now so only do this check on release images where the release domain applies
try:
print("[OnlineUpdateCheck][getFeedStatus] checking feeds state")
#req = Request("http://openvix.co.uk/TrafficLightState.php")
Expand All @@ -98,11 +98,11 @@ def getFeedStatus(self):
except:
print("[OnlineUpdateCheck][getFeedStatus] ERROR:", sys.exc_info()[0])
trafficLight = -2
if getImageType() == "developer" and "openbhdev" in getFeedsUrl():
if SystemInfo["imagetype"] == "developer" and "openbhdev" in SystemInfo["feedsurl"]:
print("[OnlineUpdateCheck][getFeedStatus] Official developer feeds")
trafficLight = "developer"
elif officialReleaseFeedsUri not in getFeedsUrl(): # if not using official feeds mark as alien. There is no status test for alien feeds (including official developer feeds).
print("[OnlineUpdateCheck][getFeedStatus] Alien feeds url: %s" % getFeedsUrl())
elif officialReleaseFeedsUri not in SystemInfo["feedsurl"]: # if not using official feeds mark as alien. There is no status test for alien feeds (including official developer feeds).
print("[OnlineUpdateCheck][getFeedStatus] Alien feeds url: %s" % SystemInfo["feedsurl"])
status = 0
trafficLight = "alien"
config.softwareupdate.updateisunstable.value = status
Expand Down Expand Up @@ -151,11 +151,11 @@ def getFeedsBool(self):
def getFeedsErrorMessage(self):
global error
if self.feedstatus == -2:
return _("Your %s %s has no internet access, please check your network settings and make sure you have network cable connected and try again.") % (getMachineBrand(), getMachineName())
return _("Your %s %s has no internet access, please check your network settings and make sure you have network cable connected and try again.") % (SystemInfo["displaybrand"], SystemInfo["machinename"])
elif self.feedstatus == -3:
return _("Your %s %s has no network access, please check your network settings and make sure you have network cable connected and try again.") % (getMachineBrand(), getMachineName())
return _("Your %s %s has no network access, please check your network settings and make sure you have network cable connected and try again.") % (SystemInfo["displaybrand"], SystemInfo["machinename"])
elif self.feedstatus == 404:
return _("Your %s %s is not able to connect to the feeds, please try again later. If this persists please report on the OpenBh forum at openbh.net") % (getMachineBrand(), getMachineName())
return _("Your %s %s is not able to connect to the feeds, please try again later. If this persists please report on the OpenBh forum at openbh.net") % (SystemInfo["displaybrand"], SystemInfo["machinename"])
elif self.feedstatus in ("updating", 403):
return _("Sorry feeds are down for maintenance, please try again later. If this issue persists please check openbh.net")
elif error:
Expand All @@ -178,7 +178,7 @@ def ipkgCallback(self, event, param):
self.ipkg.startCmd(IpkgComponent.CMD_UPGRADE_LIST)
elif self.ipkg.currentCommand == IpkgComponent.CMD_UPGRADE_LIST:
self.total_packages = len(self.ipkg.getFetchedList())
if self.total_packages and (getImageType() != "release" or (config.softwareupdate.updateisunstable.value == 1 and config.softwareupdate.updatebeta.value) or config.softwareupdate.updateisunstable.value == 0):
if self.total_packages and (SystemInfo["imagetype"] != "release" or (config.softwareupdate.updateisunstable.value == 1 and config.softwareupdate.updatebeta.value) or config.softwareupdate.updateisunstable.value == 0):
print(("[OnlineUpdateCheck][ipkgCallback] %s Updates available" % self.total_packages))
config.softwareupdate.updatefound.setValue(True)
pass
Expand Down Expand Up @@ -249,7 +249,7 @@ def createCheckJob(self):

def JobStart(self):
config.softwareupdate.updatefound.setValue(False)
if (getImageType() != "release" and feedsstatuscheck.getFeedsBool() == "unknown") or (getImageType() == "release" and feedsstatuscheck.getFeedsBool() in ("stable", "unstable")):
if (SystemInfo["imagetype"] != "release" and feedsstatuscheck.getFeedsBool() == "unknown") or (SystemInfo["imagetype"] == "release" and feedsstatuscheck.getFeedsBool() in ("stable", "unstable")):
print("[OnlineUpdateCheckPoller] Starting background check.")
feedsstatuscheck.startCheck()
else:
Expand All @@ -266,7 +266,7 @@ def __init__(self):

def getStableUpdateAvailable(self):
if config.softwareupdate.updatefound.value and config.softwareupdate.check.value:
if getImageType() != "release" or config.softwareupdate.updateisunstable.value == 0:
if SystemInfo["imagetype"] != "release" or config.softwareupdate.updateisunstable.value == 0:
print("[OnlineVersionCheck] New Release updates found")
return True
else:
Expand All @@ -277,7 +277,7 @@ def getStableUpdateAvailable(self):

def getUnstableUpdateAvailable(self):
if config.softwareupdate.updatefound.value and config.softwareupdate.check.value:
if getImageType() != "release" or (config.softwareupdate.updateisunstable.value == 1 and config.softwareupdate.updatebeta.value):
if SystemInfo["imagetype"] != "release" or (config.softwareupdate.updateisunstable.value == 1 and config.softwareupdate.updatebeta.value):
print("[OnlineVersionCheck] New Experimental updates found")
return True
else:
Expand All @@ -300,7 +300,7 @@ def kernelMismatch():
print("[OnlineUpdateCheck][kernelMismatch] unable to retrieve kernel version from STB")
return False

uri = "%s/%s/Packages.gz" % (getFeedsUrl(), getMachineBuild())
uri = "%s/%s/Packages.gz" % (SystemInfo["feedsurl"], SystemInfo["model"])
try:
req = Request(uri)
d = urlopen(req)
Expand Down Expand Up @@ -332,7 +332,7 @@ def kernelMismatch():
def statusMessage():
# returns message if status message is found, else False.
# status-message.php goes in the root folder of the feeds webserver
uri = "http://%s/status-message.php?machine=%s&version=%s&build=%s" % (getFeedsUrl().split("/")[2], getBoxType(), getImageVersion(), getImageBuild())
uri = "http://%s/status-message.php?machine=%s&version=%s&build=%s" % (SystemInfo["feedsurl"].split("/")[2], SystemInfo["boxtype"], SystemInfo["imageversion"], SystemInfo["imagebuild"])
try:
req = Request(uri)
d = urlopen(req)
Expand Down
4 changes: 2 additions & 2 deletions lib/python/Components/PackageInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from Components.NimManager import nimmanager
from Components.Ipkg import IpkgComponent
from Components.config import config, configfile
from boxbranding import getBoxType
from Components.SystemInfo import SystemInfo
from enigma import eConsoleAppContainer, eDVBDB
from os import listdir, path, system

Expand Down Expand Up @@ -271,7 +271,7 @@ def prerequisiteMet(self, prerequisites):
if "hardware" in prerequisites:
hardware_found = False
for hardware in prerequisites["hardware"]:
if hardware == getBoxType():
if hardware == SystemInfo["boxtype"]:
hardware_found = True
if not hardware_found:
return False
Expand Down
4 changes: 2 additions & 2 deletions lib/python/Components/Renderer/LcdPicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
from Components.Renderer.Renderer import Renderer
from enigma import ePixmap, ePicLoad
from Tools.Directories import pathExists, SCOPE_CURRENT_SKIN, resolveFilename
from boxbranding import getDisplayType
from Components.config import config
from Components.SystemInfo import SystemInfo
from Components.Renderer.Picon import PiconLocator


def useLcdPicons():
return getDisplayType() in ('bwlcd255', 'bwlcd140', 'bwlcd128') or config.lcd.picon_pack.value
return SystemInfo["displaytype"] in ('bwlcd255', 'bwlcd140', 'bwlcd128') or config.lcd.picon_pack.value


lcdPiconLocator = None
Expand Down
6 changes: 1 addition & 5 deletions lib/python/Components/Renderer/RollerCharLCD.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from enigma import eLabel, eTimer
from boxbranding import getBoxType

from Components.config import config
from Components.Renderer.Renderer import Renderer
Expand All @@ -11,10 +10,7 @@ class RollerCharLCD(VariableText, Renderer):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)
if getBoxType() in ('vuduo', 'sf4008'):
self.stringlength = 16
else:
self.stringlength = 12
self.stringlength = 12

GUI_WIDGET = eLabel

Expand Down
Loading

0 comments on commit a8dc68f

Please sign in to comment.