And when I see the sanity checks it looks like you try some ‘crapy’ settings?....
And please put break on a second line after the not valid check.
In your patch you put a try/except that will return "None" on failure. I just want to avoid that "None" value from being appended to the list we are creating.
One other small change is change variable name from "refstr" to "refnum"
--- plugin-old.py Mon Jun 24 23:30:40 2019
+++ plugin.py Mon Jun 24 23:29:56 2019
@@ -110,6 +110,13 @@
alternativeServices = enigma.eServiceCenter.getInstance().list(service)
return alternativeServices and alternativeServices.getContent("S", True)
+def getRefNum(ref):
+ ref = ref.split(':')[3:7]
+ try:
+ return int(ref[0], 16) << 48 | int(ref[1], 16) << 32 | int(ref[2], 16) << 16 | int(ref[3], 16) >> 16
+ except:
+ return
+
def getBouquetChannelList():
channels = [ ]
global isFilterRunning, filterCounter
@@ -140,13 +147,13 @@
altrernative_list = getAlternatives(service)
if altrernative_list:
for channel in altrernative_list:
- refstr = ':'.join(channel.split(':')[:11])
- if refstr not in channels:
- channels.append(refstr)
+ refnum = getRefNum(channel)
+ if refnum and refnum not in channels:
+ channels.append(refnum)
else:
- refstr = ':'.join(service.toString().split(':')[:11])
- if refstr not in channels:
- channels.append(refstr)
+ refnum = getRefNum(service.toString())
+ if refnum and refnum not in channels:
+ channels.append(refnum)
else:
bouquet_rootstr = '1:7:1:0:0:0:0:0:0:0:FROM BOUQUET "userbouquet.favourites.tv" ORDER BY bouquet'
bouquet_root = enigma.eServiceReference(bouquet_rootstr)
@@ -161,13 +168,13 @@
altrernative_list = getAlternatives(service)
if altrernative_list:
for channel in altrernative_list:
- refstr = ':'.join(channel.split(':')[:11])
- if refstr not in channels:
- channels.append(refstr)
+ refnum = getRefNum(channel)
+ if refnum and refnum not in channels:
+ channels.append(refnum)
else:
- refstr = ':'.join(service.toString().split(':')[:11])
- if refstr not in channels:
- channels.append(refstr)
+ refnum = getRefNum(service.toString())
+ if refnum and refnum not in channels:
+ channels.append(refnum)
isFilterRunning = 0
return channels
@@ -176,19 +183,19 @@
if not ref:
return False
sref = enigma.eServiceReference(ref)
- refstr = ':'.join(sref.toString().split(':')[:11])
+ refnum = getRefNum(sref.toString())
if config.plugins.epgimport.import_onlybouquet.value:
global BouquetChannelListList
if BouquetChannelListList is None:
BouquetChannelListList = getBouquetChannelList()
- if refstr not in BouquetChannelListList:
- print>>log, "Serviceref not in bouquets:", refstr
+ if refnum not in BouquetChannelListList:
+ print>>log, "Serviceref not in bouquets:", sref.toString()
return False
global serviceIgnoreList
if serviceIgnoreList is None:
- serviceIgnoreList = filtersServices.filtersServicesList.servicesList()
- if refstr in serviceIgnoreList:
- print>>log, "Serviceref is in ignore list:", refstr
+ serviceIgnoreList = [getRefNum(x) for x in filtersServices.filtersServicesList.servicesList()]
+ if refnum in serviceIgnoreList:
+ print>>log, "Serviceref is in ignore list:", sref.toString()
return False
if "%3a//" in ref.lower():
# print>>log, "URL detected in serviceref, not checking fake recording on serviceref:", ref