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 9, 2023
2 parents 3274103 + 11ab8a7 commit 6e3a96e
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 22 deletions.
86 changes: 65 additions & 21 deletions lib/python/Components/Converter/PliExtraInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,29 @@
from Tools.GetEcmInfo import GetEcmInfo
from Tools.Hex2strColor import Hex2strColor
from Components.Converter.Poll import Poll
from Tools.Directories import pathExists
from skin import parameters

caid_data = (
("0x1700", "0x17ff", "BetaCrypt", "B", True),
("0x600", "0x6ff", "Irdeto", "I", True),
("0x1800", "0x18ff", "Nagravision", "N", True),
("0x100", "0x1ff", "Seca Mediaguard", "S", True),
("0x1000", "0x10ff", "Tandberg", "T", True),
("0x500", "0x5ff", "Viaccess", "V", True),
("0x2600", "0x2600", "Biss", "BI", True),
("0x4aee", "0x4aee", "BulCrypt", "BU", True),
("0x5581", "0x5581", "BulCrypt", "BU", False),
("0xb00", "0xbff", "Conax", "CO", True),
("0xd00", "0xdff", "CryptoWorks", "CW", True),
("0x2700", "0x2710", "DRE-Crypt3", "DC", False),
("0x4ae0", "0x4ae1", "DRE-Crypt", "DC", False),
("0x900", "0x9ff", "NDS Videoguard", "ND", True),
("0x4afc", "0x4afc", "Panaccess", "PA", False),
("0xe00", "0xeff", "PowerVu", "PV", True),
("0x4a02", "0x4a02", "Tongfang", "TF", False),
("0x5601", "0x5604", "Verimatrix", "VM", True)
("0x1700", "0x17ff", "BetaCrypt", "B", "BETA", True),
("0x600", "0x6ff", "Irdeto", "I", "IRD", True),
("0x1800", "0x18ff", "Nagravision", "N", "NAGRA", True),
("0x100", "0x1ff", "Seca Mediaguard", "S", "SECA", True),
("0x1000", "0x10ff", "Tandberg", "T", "TAND", True),
("0x500", "0x5ff", "Viaccess", "V", "VIA", True),
("0x2600", "0x2601", "Biss", "BI", "BISS", True),
("0x2602", "0x2602", "Biss2", "BI", "BISS2", False),
("0x4aee", "0x4aee", "BulCrypt", "BU", "BUL1", True),
("0x5581", "0x5581", "BulCrypt", "BU", "BUL2", False),
("0xb00", "0xbff", "Conax", "CO", "CONAX", True),
("0xd00", "0xdff", "CryptoWorks", "CW", "CRW", True),
("0x2700", "0x2710", "DRE-Crypt3", "DC", "DRE3", False),
("0x4ae0", "0x4ae1", "DRE-Crypt", "DC", "DRE", False),
("0x900", "0x9ff", "NDS Videoguard", "ND", "NDS", True),
("0x4afc", "0x4afc", "Panaccess", "PA", "PAN", False),
("0xe00", "0xeff", "PowerVu", "PV", "PV", True),
("0x4a02", "0x4a02", "Tongfang", "TF", "TONG", False),
("0x5601", "0x5604", "Verimatrix", "VM", "VM", True)
)

# stream type to codec map
Expand Down Expand Up @@ -186,6 +188,7 @@ def __init__(self, type):
("CryptoCaidTandbergAvailable", "T", False),
("CryptoCaidViaAvailable", "V", False),
("CryptoCaidBissAvailable", "BI", False),
("CryptoCaidBiss2Available", "BI", False),
("CryptoCaidBulCrypt1Available", "BU", False),
("CryptoCaidBulCrypt2Available", "BU", False),
("CryptoCaidConaxAvailable", "CO", False),
Expand All @@ -204,6 +207,7 @@ def __init__(self, type):
("CryptoCaidTandbergSelected", "T", True),
("CryptoCaidViaSelected", "V", True),
("CryptoCaidBissSelected", "BI", True),
("CryptoCaidBiss2Selected", "BI", True),
("CryptoCaidBulCrypt1Selected", "BU", True),
("CryptoCaidBulCrypt2Selected", "BU", True),
("CryptoCaidConaxSelected", "CO", True),
Expand Down Expand Up @@ -255,14 +259,24 @@ def createCryptoBar(self, info):
except:
pass

if color != Hex2strColor(colors[2]) or caid_entry[4]:
if color != Hex2strColor(colors[2]) or caid_entry[5]:
if res:
res += " "
res += color + caid_entry[3]

res += Hex2strColor(colors[3]) # white (this acts like a color "reset" for following strings
return res

def createCurrentCaidLabel(self):
res = ""
if not pathExists("/tmp/ecm.info"):
return "FTA"
for caid_entry in caid_data:
if int(caid_entry[0], 16) <= int(self.current_caid, 16) <= int(caid_entry[1], 16):
res = caid_entry[4]

return res

def createCryptoSeca(self, info):
available_caids = info.getInfoObject(iServiceInformation.sCAIDs)
if int('0x100', 16) <= int(self.current_caid, 16) <= int('0x1ff', 16):
Expand Down Expand Up @@ -473,13 +487,29 @@ def createCryptoNagra(self, info):

def createCryptoBiss(self, info):
available_caids = info.getInfoObject(iServiceInformation.sCAIDs)
if int('0x2600', 16) <= int(self.current_caid, 16) <= int('0x26ff', 16):
if int('0x2600', 16) <= int(self.current_caid, 16) <= int('0x2601', 16):
color = Hex2strColor(self.cryptocolors[0])
else:
color = Hex2strColor(self.cryptocolors[1])
try:
for caid in available_caids:
if int('0x2600', 16) <= caid <= int('0x2601', 16):
color = Hex2strColor(self.cryptocolors[2])
except:
pass
res = color + 'BI'
res += Hex2strColor(self.cryptocolors[3])
return res

def createCryptoBiss2(self, info):
available_caids = info.getInfoObject(iServiceInformation.sCAIDs)
if int('0x2602', 16) <= int(self.current_caid, 16) <= int('0x26ff', 16):
color = Hex2strColor(self.cryptocolors[0])
else:
color = Hex2strColor(self.cryptocolors[1])
try:
for caid in available_caids:
if int('0x2600', 16) <= caid <= int('0x26ff', 16):
if int('0x2602', 16) <= caid <= int('0x26ff', 16):
color = Hex2strColor(self.cryptocolors[2])
except:
pass
Expand Down Expand Up @@ -901,6 +931,13 @@ def getTextByType(self, textType):
if not info:
return ""

if textType == "CurrentCrypto":
if int(config.usage.show_cryptoinfo.value) > 0:
self.getCryptoInfo(info)
return self.createCurrentCaidLabel()
else:
return ""

if textType == "CryptoBar":
if int(config.usage.show_cryptoinfo.value) > 0:
self.getCryptoInfo(info)
Expand Down Expand Up @@ -985,6 +1022,13 @@ def getTextByType(self, textType):
else:
return ""

if textType == "CryptoBiss2":
if int(config.usage.show_cryptoinfo.value) > 0:
self.getCryptoInfo(info)
return self.createCryptoBiss(info)
else:
return ""

if textType == "CryptoDre":
if int(config.usage.show_cryptoinfo.value) > 0:
self.getCryptoInfo(info)
Expand Down
2 changes: 1 addition & 1 deletion lib/python/Components/Converter/VAudioInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def getAudioCodec(self, info):
return description_str

def getAudioIcon(self, info):
description_str = self.get_short(self.getAudioCodec(info).translate(str.maketrans(None, ' .')).lower())
description_str = self.get_short(self.getAudioCodec(info).translate(str.maketrans(' ', ' .')).lower())
return description_str

def get_short(self, audioName):
Expand Down
63 changes: 63 additions & 0 deletions lib/python/Components/Renderer/AudioIcon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
from Components.Renderer.Renderer import Renderer
from enigma import ePixmap
from Tools.Directories import fileExists, SCOPE_GUISKIN, resolveFilename
from Tools.LoadPixmap import LoadPixmap


class AudioIcon(Renderer):
def __init__(self):
Renderer.__init__(self)
self.size = None
self.width = 51
self.height = 30
self.nameAudioCache = {}
self.pngname = ""
self.path = ""

def applySkin(self, desktop, parent):
attribs = []
for (attrib, value) in self.skinAttributes:
if attrib == "path":
self.path = value
if value.endswith("/"):
self.path = value
else:
self.path = value + "/"
else:
attribs.append((attrib, value))
if attrib == "size":
value = value.split(',')
if len(value) == 2:
self.width = int(value[0])
self.height = int(value[1])
self.size = value[0] + "x" + value[1]
self.skinAttributes = attribs
return Renderer.applySkin(self, desktop, parent)

GUI_WIDGET = ePixmap

def changed(self, what):
if self.instance:
pngname = ""
if what[0] != self.CHANGED_CLEAR:
sname = self.source.text
pngname = self.nameAudioCache.get(sname, "")
if pngname == "":
pngname = self.findAudioIcon(sname)
if pngname != "":
self.nameAudioCache[sname] = pngname
if pngname == "":
self.instance.hide()
else:
self.instance.show()
if pngname != "" and self.pngname != pngname:
is_svg = pngname.endswith(".svg")
png = LoadPixmap(pngname, width=self.width, height=0 if is_svg else self.height)
self.instance.setPixmap(png)
self.pngname = pngname

def findAudioIcon(self, audioName):
pngname = resolveFilename(SCOPE_GUISKIN, self.path + audioName + ".svg")
if fileExists(pngname):
return pngname
return ""

0 comments on commit 6e3a96e

Please sign in to comment.