su1s / e2m3u2bouquet

Enigma2 IPTV m3u parser and bouquet creator
GNU General Public License v3.0
68 stars 50 forks source link

How can I sort VOD streams within a bouquet #137

Open CellsReinvent opened 1 year ago

CellsReinvent commented 1 year ago

I want to be able to sort the individual VOD streams within each VOD bouquet - so that all the movies or series are sorted alphabetically, by stream-name/title.

I'm slightly comfortable editing the python., but by no means a python coder.

In the _parse_map_channels_xml function, in the if block that only parses live streams

if self._category_options[cat].get('type', 'live') == 'live':
  ...
else:
  # my VOD code goes here

I've removed the for loop that checks the override for categoryOverride

Pretty sure I need to change the lambda sort function, but to my novice Python eyes, it already seems to be sorting by stream-name

Can anyone help me out?

listchannels = OrderedDict((x, True) for x in sortedchannels).keys()

channel_order_dict = {channel: index for index, channel in enumerate(listchannels)}
self._dictchannels[cat].sort(key=lambda x: channel_order_dict[x['stream-name']])