bebo-dot-dev / m3u-epg-editor

a python m3u / epg optimizer
The Unlicense
125 stars 29 forks source link

Ignore non HD / FHD channels #16

Closed a8ree closed 6 years ago

a8ree commented 6 years ago

I cannot work out how to ignore channels that don't have a 'HD' or 'FHD' in the title. I've tried using the -C option but cannot get the Regex to work

Is this possible?

bebo-dot-dev commented 6 years ago

--channels [CHANNELS], -c [CHANNELS] Channels in the m3u to discard. Regex pattern matching is supported

As described above (from the readme), the -c argument is used to throw channels away, not keep channels.

If you only want to keep channels that have 'HD' or 'FHD' in the title, your -c argument will need to match all other channels that you're not interested in keeping, either by specifying one or more regex expressions to match a range of channels or by one or more exact channel names. Any channels matched with the -c argument will be discarded / not kept in the resulting output m3u.

There are a couple of examples of the use of the -c argument in the readme in the sample usage calls section.

a8ree commented 6 years ago

Yep, I'd spotted that and tried some Regex

As per https://stackoverflow.com/questions/406230/regular-expression-to-match-a-line-that-doesnt-contain-a-word e.g. ^((?!HD).)*$

bebo-dot-dev commented 6 years ago

Something like that might work but I'm not in a position to debug your regex expressions against some text in a source m3u file that I can't see.

Whatever you do, keep in mind that regex expression dialect can be language specific. Plucking code snips from SO may or may not work depending on the context and use case.

It might be a good idea to test your regex expressions using an online regex tester that supports python regex dialect against your m3u source text i.e. https://regex101.com

bebo-dot-dev commented 6 years ago

I'm not sure if you managed to get this working @a8ree

To answer your original question, yes this is possible providing the supplied -c / --channels regex expression matches channels to be discarded as expected and other channel filtering options are configured correctly i.e. -g / --groups to keep.

I'm going to leave this open for a few more days just in case you have anything to add and then it will be closed.

a8ree commented 6 years ago

I couldn't get it working so ended up opting for a service instead. Thanks for all your help though