Skip to content

Commit

Permalink
* add support for lcndb version 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleyel committed Jul 31, 2024
1 parent 4ad8b75 commit 3d37abe
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions plugin/controllers/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,12 +297,26 @@ def getLCNs():
lines = []
with open("/etc/enigma2/lcndb") as fd:
lines = [line.strip().upper() for line in fd.readlines()]
for lcn in lines:
lcnData = lcn.split(":")
lcnKey = lcnData[:4]
lcns[f"{int(lcnKey[3], 16):X}:{int(lcnKey[2], 16):X}:{int(lcnKey[1], 16):X}:{lcnKey[0]}"] = int(lcnData[4])

if lines and lines[0] == "#VERSION 2":
del lines[0]
for lcn in lines:
lcnData = lcn.split(":")
lcnKey = lcnData[7]
if lcnKey == "0":
lcnKey = lcnData[6]
if lcnKey == "0":
lcnKey = lcnData[5]
lcns[f"{int(lcnData[0], 16):X}:{int(lcnData[1], 16):X}:{int(lcnData[2], 16):X}:{lcnData[3]}"] = int(lcnKey)
else:
for lcn in lines:
lcnData = lcn.split(":")
lcnKey = lcnData[:4]
lcns[f"{int(lcnKey[3], 16):X}:{int(lcnKey[2], 16):X}:{int(lcnKey[1], 16):X}:{lcnKey[0]}"] = int(lcnData[4])
except OSError:
pass
except Exception as err:
print(f"[OpenWebif] Error parsing lcn db. {err}")
return lcns


Expand Down

0 comments on commit 3d37abe

Please sign in to comment.