martinrotter / rssguard

Feed reader (and podcast player) which supports RSS/ATOM/JSON and many web-based feed services.
GNU General Public License v3.0
1.65k stars 125 forks source link

[FR]: move filter down\up to change execution order #908

Open Owyn opened 1 year ago

Owyn commented 1 year ago

Brief description of the feature request

I have two filters for one feed group:

  1. check that there are no dupes if (msg.isAlreadyInDatabase(MessageObject.SameUrl)) return MessageObject.Ignore;

and

  1. fix url (because rss server gives out urls of wrong website)
    
    msg.url = msg.url.replace(/nitter\.fly\.dev/g, 'notabird.site');

msg.contents = msg.contents.replace(/nitter.fly.dev/g, 'notabird.site');



but the problem is that 1st filter stops working (because of my url fixing filter I presume), - would be nice to be able to change filter execution order so I could fix that
martinrotter commented 1 year ago

Well, this is actually valid proposition.

Perhaps, you could re-write your filters to somehow be interchangeable when it comes to "execution order"?

RetroAbstract commented 1 year ago

Additional features could be:

Edit: added filter categories feature suggestion

Mitecon commented 1 year ago

I'd like to add to this request. I have almost 200 filters currently set up.

It was fine at first because I would map out the filters I wanted to add somewhere else, then add them in the order I'd decided upon. However, once I'd added all my nicely-named filters, I inevitably ended up adding some more.

Alphabetically, these filters would look neatly organised and trigger in the order I wanted. For a lot of my filters, the execution order does not matter. These are filters that affect maybe one or two feeds, so other filters have no effect and do not conflict with each other.

However, I've since needed to add more filters that are global. These new filters end up at the bottom of the list, firing after everything else. It's a lot of CPU cycles to eat - sometimes for no reason since newer filters may delete some of the articles that other filters have already processed.

Consider the scenario:

New articles come in
A filter applies a label to that article
A later filter decides that this article was never wanted in the first place, then applies 'Ignore'

How is this handled? If the later filter could have been executed first, then the article would never have made it into the database.

But because it's been labeled and, presumably, now stored in the database - it cannot now be ignored and prevented from entering the database.

So the I'd have to change filters with 'Ignore' to 'Purge' which I may not be entirely comfortable with unless I was absolutely sure. However, in the scenario above, a filter could pick up an article that the later filter discards. So this is a conflict.

Besides which, you're wasting time and CPU cycles performing a redundant action upon articles that should have instantly been discarded and never entered into the database.

It could be argued that I could rewrite a filter or two at the top of the list to do the same things as the filters at the bottom and therefore replace them. The problem with this, for me, is that I'm basically learning Javascript purely to be able to use RSS Guard. If I was a Javascript pro and knew all the little tricks then this would probably be no issue.

As I said - I have nearly 200 filters running at the moment. I have this many for readability and maintenance purposes. Some are simple while others are much more convoluted. If I dump all my conditions into one filter just to be able to organise them, I don't know the implications for performance. As well as the fact that one little mistake could knock out a whole entire filter which could have unforeseen consequences or literally do nothing at all, whereas many separate filters can be made just the once and left alone forever after that.

If nothing else, I'd like at least for filters to be sortable alphabetically. At the moment, a filter list might look like:

Global.Filter.Made.Right.At.The.Beginning
Local.Filter.This
Local.Filter.That
Local.Filter.The.Other
Global.Filter.Made.Recently
Local.Filter.Whatever

Then it's a simple case of prefixing filters with something to fix their positions like:

001.Global.Filter.1
002.Global.Filter.2
Local.Filter.001.Whatever
Local.Filter.002.This
Local.Filter.003.That
Local.Filter.004.The.Other

I propose a simple button that says 'Sort'.