OpenViX / enigma2

GNU General Public License v2.0
58 stars 107 forks source link

Include sd, fhd, and uhd in picon.py #920

Closed kiddac closed 10 months ago

kiddac commented 1 year ago

In a world of iptv would it be possible to amend the picon.py to include iptv references like sd, fhd, uhd, 4k

Currently SNP picons look for name and if ends with HD strips the HD

It would now be better if this code also incorporates other IPTV values like SD,4K, FHD, UHD to pick up more IPTV channels

Example new code.

if not pngname:
    name = sanitizeFilename(eServiceReference(serviceRef).getServiceName())
    name = re.sub("[^a-z0-9]", "", name.replace("&", "and").replace("+", "plus").replace("*", "star").lower())
    if len(name) > 0:
        pngname = findPicon(name)
        if not pngname and len(name) > 3 and (name.endswith("fhd") or names.endswith("uhd")) :
            pngname = findPicon(name[:-3])      
        if not pngname and len(name) > 2 and (name.endswith("hd") or names.endswith("sd") or names.endswith("4k") ):
            pngname = findPicon(name[:-2])` 
kiddac commented 1 year ago

jbleyel on openatv has recommended a regex solution instead

if not pngname:
  name = sub("uhd$|fhd$|sd$|hd$|4k$", "", name)
  if name:
    pngname = findPicon(name)
Huevos commented 1 year ago

Maybe, but regex is slow and this is going to be called for every picon that doesn't match. You need to try in ServiceList with Picons active on an IPTV bouquet and see if you notice a pause.

Huevos commented 1 year ago

You also need to strip possible spaces.

AbuBaniaz commented 10 months ago

Added here: https://github.com/OpenViX/enigma2/commit/bb32df11dc3846e3cd32df9648d45f9c043ede5e