openatv / enigma2

openatv-gui
GNU General Public License v2.0
200 stars 317 forks source link

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

Closed kiddac closed 10 months ago

kiddac commented 10 months 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 = ServiceReference(serviceName).getServiceName()  # Picon by channel name
    name = normalize("NFKD", name).encode("ASCII", "ignore").decode()
    name = 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])`     
jbleyel commented 10 months ago

Have you tested this?

kiddac commented 10 months ago

Nope. But I can do for you.

jbleyel commented 10 months ago

Nope. But I can do for you.

I'm thinking about to use regex instead. Because it's probably faster.

jbleyel commented 10 months ago

`

    name = sub("[^a-z0-9]", "", name.replace("&", "and").replace("+", "plus").replace("*", "star").lower())
    if name:
        pngname = findPicon(name)
        if not pngname:
            name = sub("uhd$|fhd$|sd$|hd$|4k$", "", name)
            if name:
                pngname = findPicon(name)

`

kiddac commented 10 months ago

Either way it would be an improvement.

using simple additions to existing code. I editted my code above as the the 3 chars had to come before the 2 chars.

before image

after image

I will try a regex solution now. We possibly could get away with not being the end of line too. "SD" being the only one that could potentially exist in the middle of a channel name.

That way if a name for example is [SD] BBC ONE. It would fix that one too.

kiddac commented 10 months ago

your regex sub works as expected too.

image

Masta2002 commented 10 months ago

@kiddac , @jbleyel would it be possible to add these IPTV picons in subfolders? Like IPTVProvider1, IPTVProvider2, and so on?

With PlutoTV, BMX, SamsungTV and all this plugins that creates Picons an Bouquets the Picon directory gets so big and not easy to manage without folders in it

kiddac commented 10 months ago

And to clarify what @Masta2002 is getting at. My new plugin bouquetmakerxtream for example now has a picon downloader included

The user selects the picon location.

i.e media/hdd/picon/

All picons get downloaded into that folder.

Picon.py is currently coded to only look for PNGs in /picon/ folder of that mount and not also subfolders of that /picon/ folder. Which not only would be good for iptv picons, but also allow the organisation of other downloaded picon sets

jbleyel commented 10 months ago

Hello @Masta2002 , subfolders for picons will be very complex and complicated. So I'm not intended to implement this now.

Papi2000-new commented 10 months ago

How ever this discussion will end, i suggest to only use one single path for ALL picons in the system. Every other attempt will lead to massive confusions, need much effort to implement, and also support will be not longer possible.