Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed filters feature #243

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

beastwick
Copy link

@beastwick beastwick commented Oct 6, 2023

Allow the user to configure filters on their feeds, so they will only be emailed items in which they are only interested. This can be accomplished by setting the new 'filters' field in the feed's options found in the rss2email.cfg file. The value can be a '|' delimited list of values.

Within rss2email.cfg, the user must manually add this field:

[feed.kernel]                                                                                                                                                     
url = https://www.kernel.org/feeds/kdist.xml                                                                                                                      
filters = stable                                                                                                                                                                                                                                                                                                                    

[feed.debian.linux]                                                                                                                                               
url = https://tracker.debian.org/pkg/linux/rss                                                                                                                    
filters = testing|unstable

@auouymous
Copy link
Contributor

Good idea!

It might be better to use something like "filter_subject" so users know it only matches the subject.

Does it print a message for feeds without a filter?

Since it uses regular expression matching, there is no reason to split and iterate, just pass the entire filter and perform a single match. Your examples will still work.

gPodder has a filter extension with block and except options, so it can block all with an empty field, and make exceptions with the except field. That gives the user more choice in what to block or allow. It also has checkboxes for each field to ignore case and switch between text matching and regular expressions. That would be more difficult to specify in the config, but might help users who don't know how to use regular expressions. We could ignore case for all filters, but that can cause issues for certain words.

@beastwick
Copy link
Author

beastwick commented Oct 26, 2023

Hey @auouymous thanks for your feedback. I updated the variable name to filter_subject, removed the pipe delimiter logic, and added some logging to stdout as suggested.

2023-10-26 14:06:31,525 [INFO] Filter testing|unstable matched in feed.debian.yt-dlp, Accepted yt-dlp 2023.10.13-1 (source) into unstable                                                                       
2023-10-26 14:06:31,527 [INFO] Filter testing|unstable matched in feed.debian.yt-dlp, yt-dlp 2023.10.13-1 MIGRATED to testing

@beastwick beastwick marked this pull request as ready for review October 26, 2023 18:31
@beastwick beastwick changed the title Feed Filters Feed filters feature. Oct 26, 2023
@beastwick beastwick changed the title Feed filters feature. Feed filters feature Oct 26, 2023
…ilter match. If one is found, set a flag to send the entry.

No need to pipe delimit a regex.
filter_subject variable name for clarity.
Use log function for stdout consistency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants