Skip to content

Add keyword filter to !channels command#23

Merged
dev-topsoil merged 2 commits into
dev-topsoil:developfrom
alekstu:channels-filter
Jun 12, 2026
Merged

Add keyword filter to !channels command#23
dev-topsoil merged 2 commits into
dev-topsoil:developfrom
alekstu:channels-filter

Conversation

@alekstu

@alekstu alekstu commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an optional [keyword] argument to !channels so users can filter the channel list by name instead of paging through hundreds of results
  • Filter is case-insensitive substring match, works across both TVheadend and IPTV channels
  • Returns a helpful message when no channels match the keyword

Test plan

  • !channels with no argument still lists all channels as before
  • !channels bbc (or any keyword) returns only channels whose name contains the keyword
  • Filter is case-insensitive (!channels BBC and !channels bbc return the same results)
  • No match returns no channels found matching **keyword**
  • Unit tests pass in CI

!channels [keyword] now accepts an optional name filter so users with
large channel lists can narrow results without paging through everything.
Covers TVheadend and IPTV channels, returns a helpful message when no
channels match, and leaves existing pagination untouched.
@dev-topsoil

Copy link
Copy Markdown
Owner

Thanks for the Pull Request!

I like the changes but the unit test are failing, see here and below:

FAILED tests/test_tv.py::test_channels_filter_case_insensitive - AssertionError: assert [] == [{'name': 'Zo...id': 'zorb2'}]
  
  Right contains 2 more items, first extra item: {'name': 'Zorbax One', 'source': 'src-a', 'tvg_id': 'zorb1'}
  
  Full diff:
  + []
  - [
  -     {
  -         'name': 'Zorbax One',
  -         'source': 'src-a',
  -         'tvg_id': 'zorb1',
  -     },
  -     {
  -         'name': 'Zorbax Two',
  -         'source': 'src-a',
  -         'tvg_id': 'zorb2',
  -     },
  - ]
1 failed, 160 passed in 1.99s

If you fix the tests, I'll approve the PR and merge the branch.

@dev-topsoil dev-topsoil added the enhancement New feature or request label Jun 10, 2026
The _apply_filter helper lowercased ch["name"] but not the query itself,
so uppercase queries like "ZORBAX" never matched.
@dev-topsoil

Copy link
Copy Markdown
Owner

The unit tests passed in CI - the workflow only failed because of repository permissions (guess I should skip posting code coverage as a comment for forked PRs...)

Thanks for the PR. I'll approve and merge it.

@dev-topsoil
dev-topsoil merged commit 4a4b6ff into dev-topsoil:develop Jun 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants