bebo-dot-dev / m3u-epg-editor

a python m3u / epg optimizer
120 stars 27 forks source link

Feature Request: Filter based on URL of channel #74

Closed P-a-d-r-a-i-g closed 1 year ago

P-a-d-r-a-i-g commented 1 year ago

Hi,

I would like to request a feature which would allow filtering of the M3U file via a --urlFilter option, with associated discard or keep property (default:discard).

An example of this would be to remove entries that have a URL of e.g. --urlFilter="'/series/','/movies'/" so only TV channels are left.

The filter would work with or without any of the other filters, meaning if literally all you wanted to do was remove series and movie entries then that is the only filtering option you would pass.

bebo-dot-dev commented 1 year ago

Hi there, that sounds like a generally useful feature, it should be an easy enough addition.

Your --urlFilter example suggests it will want to use a regular expression match and I agree, that will be best.

I'm away this week but I'll take a look asap when I get back.

P-a-d-r-a-i-g commented 1 year ago

Hi again,

Yes, the regular expression would be best for this I believe too.

Thanks.

bebo-dot-dev commented 1 year ago

Hi @padraigdoran there's a candidate in the https://github.com/bebo-dot-dev/m3u-epg-editor/tree/url-filtering branch

Two new arguments have been introduced to support the feature: discard_urls and include_urls (both optional). Rather than the UrlMode keep/discard idea, this approach fitted better with the pre-existing channel filtering logic in the script and hopefully it should be more flexible.

One thing to note is that configured keep configuration always overrides exclude configuration. What this means in practice is that if i.e. configuration is specified to keep a channel and overlapping configuration exists to exclude a channel by url, the channel keep configuration would "win".

Give it a whirl and let me know what you think.

bebo-dot-dev commented 1 year ago

@padraigdoran no comment in two months tells me that #76 is either working as expected or no longer wanted. #76 is merged, this is closed.