euzu / m3u-filter

m3u-filter (iptv filter) is an application which can filter/rename/map entries out of a playlist in M3U / XTREAM format and can save/serve it as m3u, xtream or kodi format. It can be used as reverse or redirect proxy for xtream.
MIT License
62 stars 6 forks source link

Inconsistent category_ids #41

Closed 36-chambers closed 5 months ago

36-chambers commented 5 months ago

Describe the bug Every time the source refreshes the categories seem to be randomly sorted. For instance, when my source pulls it gets the following categories

  1. Sports Networks: 1
  2. Network TV: 2
  3. NHL: 3

When the source is pulled again (with cron) their ids are shuffled. This breaks my client because it expects the categories to be consistent. If the categories are shuffled while I'm using the app then when I select one category it will use the ID of that category to select streams and it will get incorrect data.

To Reproduce Steps to reproduce the behavior:

  1. Pull source
  2. get_live_categories
  3. Pull source
  4. get_live_categories
  5. IDs are different every time

Expected behavior I expect the category ids to be consistent every time. If it's possible I think using the upstream category ids would be ideal so that they are passed through and you can guarantee consistency. Otherwise it would be nice if I could at least map the category ids.

euzu commented 5 months ago

I have now implemented a fix which should preserve the category id, as long as there is no modification. If mapping or something occurs, the category_id is calculated. Changes are in master branch.

36-chambers commented 5 months ago

Great thanks! How are the categories calculated?

euzu commented 5 months ago

If the title.matches the category it gets the provider id, if not the new category gets a new id based on a counter whit the initial value max(provider id)

euzu commented 5 months ago

@RohirrimRider I have implemented a new approach, pushed to master.

36-chambers commented 5 months ago

Seems to be resolved now