Here some extreme experimental code that can restore flags from a backup lamedb5..It stores the backup in a dict and then parses the 'new' lamedb where it removes the flags and prios and then load the new ones into them when the serviceref already exists in the backup lamedb5. Just to demonstrate this can be done relatively simple... and als you can see the lamedb5 new protocol does make it simple!
So when we create a backup lamedb5 before we reload/upload/scan services we can 'restore' all the flags quickly..
import re
channels = {}
for line in open('/etc/enigma2/lamedb5.bak', 'r').readlines():
line = line.strip()
if line[0] == 's':
line = re.compile(r'''((?:[^,"']|"[^"]*"|'[^']*')+)''').split(line)[1::2]
channels[line[0]] = [x for x in line[2:] if x[0] in "fc"]
newlamedb=[]
for line in open('/etc/enigma2/lamedb5', 'r').readlines():
line = line.strip()
if line[0] == 's':
line = re.compile(r'''((?:[^,"']|"[^"]*"|'[^']*')+)''').split(line)[1::2]
if line[0] in channels:
newlamedb.append(','.join(line[:2] + [x for x in line[2:] if x[0] not in "fc"] + channels[line[0]]))
else:
newlamedb.append(','.join(line))
else:
newlamedb.append(line)
for x in newlamedb:
print x
Edited by littlesat, 28 September 2018 - 15:42.