hi kiddac,
I've written a function just to group the live channels by their resolutions/qualities with the same suffixes such as 4k, fhd, hd, hd+, vip in their names...
Since some providers list the same channel with different qualities among each other which is sometimes annoying to switch to the next channel, it was necessary for me to group them like this.
e.g
### news ###
atv vip
atv hd+
atv hd
btv vip
btv hd+
btv hd
ctv hd+
ctv hd
...
### news ###
atv vip
btv vip
atv hd+
btv hd+
ctv hd+
atv hd
btv hd
ctv hd
...
the function doesn't check the exact qualities nor sort the channels by their names and it also leaves the order of the channels unchanged where no grouping is used.
Code
globalfunctions.py
def sgroup(service):
if not service['name'][0].isalnum():
return service['name']
res = service['name'].split()[-1].lower()
if '4k' in res or 'hd' in res:
return res
return 'zzz'
def process_category
...
if category_type == 'Live':
# get all the values for this live category
streamvalues = [stream for stream in jglob.livestreams if str(category_id) == str(stream['category_id'])]
streamvalues = sorted(streamvalues, key=sgroup)
streamvaluesgroup += streamvalues
Display More
maybe you want to integrate such an option with a better approach