Skip to content

Commit

Permalink
BQE improve spacer
Browse files Browse the repository at this point in the history
  • Loading branch information
jbleyel committed Oct 28, 2023
1 parent 77ef601 commit 0915762
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
4 changes: 2 additions & 2 deletions plugin/controllers/BQE.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ def P_getservices(self, request):
for sitem in sfulllist:
sref = sitem[0].toString()
hs = (int(sref.split(":")[1]) & 512)
sp = (sref[:7] == '1:832:D')
sp = sitem[0].flags & eServiceReference.isNumberedMarker
if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images
opos = opos + 1
if not sp and sitem[0].flags & eServiceReference.isMarker:
opos = opos - 1
sref = item[0].toString()
hs = (int(sref.split(":")[1]) & 512)
sp = (sref[:7] == '1:832:D')
sp = item[0].flags & eServiceReference.isNumberedMarker
if not hs or sp: # 512 is hidden service on sifteam image. Doesn't affect other images
pos = pos + 1
service = {}
Expand Down
26 changes: 10 additions & 16 deletions plugin/controllers/BouquetEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def addProviderToBouquetlist(self, param):
providername = provider.getServiceName()
servicehandler = eServiceCenter.getInstance()
services = servicehandler.list(provider.ref)
return self.addBouquet(providername, mode, services and services.getContent('R', True))
return self.addBouquet(providername, mode, services and services.getContent("R", True))

def removeBouquet(self, param):
print(f"[WebComponents.BouquetEditor] removeBouquet with param = {param}")
Expand Down Expand Up @@ -347,10 +347,7 @@ def addMarkerToBouquet(self, param):
mutablebouquetlist = self.getMutableList(bouquet_ref)
cnt = 0
while mutablebouquetlist:
if name is None:
service_str = f'1:832:D:{cnt}:0:0:0:0:0:0:'
else:
service_str = f'1:64:{cnt}:0:0:0:0:0:0:0::{name}'
service_str = f'1:320:0:{cnt}:0:0:0:0:0:0:' if name is None else f"1:64:{cnt}:0:0:0:0:0:0:0::{name}"
ref = eServiceReference(service_str)
if not mutablebouquetlist.addService(ref, srefbefore):
mutablebouquetlist.flushChanges()
Expand Down Expand Up @@ -550,7 +547,7 @@ def backupFiles(self, param):
backupfilename = pathjoin(self.BACKUP_PATH, tarfilename)
if exists(backupfilename):
remove(backupfilename)
checkfile = pathjoin(self.BACKUP_PATH, '.webouquetedit')
checkfile = pathjoin(self.BACKUP_PATH, ".webouquetedit")
try:
with open(checkfile, "w") as fd:
fd.write("created with WebBouquetEditor")
Expand Down Expand Up @@ -666,12 +663,12 @@ def setRoot(self, bouquet_rootstr):

def buildBouquetID(self, str, prefix, mode):
tmp = str.lower()
name = ''
name = ""
for c in tmp:
if (c >= 'a' and c <= 'z') or (c >= '0' and c <= '9'):
if (c >= "a" and c <= "z") or (c >= "0" and c <= "9"):
name += c
else:
name += '_'
name += "_"
# check if file is unique
suffix = ""
if mode == MODE_TV:
Expand Down Expand Up @@ -702,7 +699,7 @@ def getName(self, ref):
def importBouquet(self, param):
if config.usage.multibouquet.value:
import json
ret = [False, 'json format error']
ret = [False, "json format error"]
mode = MODE_TV
try:
bqimport = json.loads(param["json"][0])
Expand All @@ -729,19 +726,16 @@ def importBouquet(self, param):
mutablebouquetlist.addService(new_bouquet_ref)
mutablebouquetlist.flushChanges()

if overwrite == 1:
f = open(fullfilename, 'w')
else:
f = open(fullfilename, 'a')
f = open(fullfilename, "w" if overwrite == 1 else "a")
if f:
for line in lines:
f.write(line)
f.write("\n")
f.close()
else:
return [False, 'error creating bouquet file']
return [False, "error creating bouquet file"]

eDVBDB.getInstance().reloadBouquets()
return [True, 'bouquet added']
return [True, "bouquet added"]
else:
return [False, _("Multi-Bouquet is not enabled!")]

0 comments on commit 0915762

Please sign in to comment.