|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.clapper.curn.plugins.ArticleFilterPlugIn
public class ArticleFilterPlugIn
The ArticleFilterPlugIn provides per-feed filtering capabilities. It can be used to filter out items (articles) that match one or more regular expressions.
The filtering syntax is (shamelessly) adapted from the rawdog RSS reader's article-filter plug-in. (rawdog is similar to curn: It's a command line-driven RSS reader, written in Python.) A feed filter is configured by adding an ArticleFilter property to the feed's configuration section. The property's value consists of one or more filter command sequences, separated by ";" characters. (The ";" must be surrounded by white space; see below.) Each filter command sequence is of this form:
show|hide [field 'regexp' [field 'regexp' ...]]
field can be one of:
Each regular expression must be enclosed in single quotes.
For example:
hide author 'Raymond Luxury-yacht' ; show author 'Arthur .Two-sheds. Jackson'
If the command is "hide", then the entry will be hidden if the specified field matches the regular expression. If the command is "show", then the entry will be shown if the field matches the regular expression. If there are no fields or regular expressions, then the command is a wildcard match. That is:
hide
is equivalent to:
hide any '.*'
and:
show
is equivalent to:
show any '.*'
Wildcard matches are useful in situations where you want to hide or show "everything but ...". See the examples, below, for details.
All filtering commands are processed, and the end result is what defines whether a given entry is suppressed or not. Regular expressions are matched in a case-blind fashion. The match logic also
You can use multiple ArticleFilter parameters per feed (as long as they have unique suffixes. All filters are applied to each article to determine whether the article should be filtered out or not.
Some examples will help clarify the syntax.
For example, the following set of commands hide all articles with the phrase "mash-up" (because mash-ups bore me):
ArticleFilter: hide any 'mash[- \t]?up'
The following, more complicated, entry hides everything by author "Joe Blow", unless the title has the word "rant" in it ('cause his rants are hilarious):
ArticleFilter: hide author '^joe *blow$' ; show author '^joe *blow$' title rant
Finally, this example hides everything except articles by Moe Howard:
ArticleFilter: hide ; show author '^moe *howard$'
| Constructor Summary | |
|---|---|
ArticleFilterPlugIn()
Default constructor (required). |
|
| Method Summary | |
|---|---|
java.lang.String |
getPlugInName()
Get a displayable name for the plug-in. |
java.lang.String |
getPlugInSortKey()
Get the sort key for this plug-in. |
void |
initPlugIn()
Initialize the plug-in. |
boolean |
runFeedConfigItemPlugIn(java.lang.String sectionName,
java.lang.String paramName,
CurnConfig config,
FeedInfo feedInfo)
Called immediately after curn has read and processed a configuration item in a "feed" configuration section. |
boolean |
runPostFeedParsePlugIn(FeedInfo feedInfo,
RSSChannel channel)
Called immediately after a feed is parsed, but before it is otherwise processed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArticleFilterPlugIn()
| Method Detail |
|---|
public java.lang.String getPlugInName()
getPlugInName in interface PlugInpublic java.lang.String getPlugInSortKey()
getPlugInSortKey in interface PlugIn
public void initPlugIn()
throws CurnException
initPlugIn in interface PlugInCurnException - on error
public boolean runFeedConfigItemPlugIn(java.lang.String sectionName,
java.lang.String paramName,
CurnConfig config,
FeedInfo feedInfo)
throws CurnException
runFeedConfigItemPlugIn in interface FeedConfigItemPlugInsectionName - the name of the configuration section where
the item was foundparamName - the name of the parameterconfig - the active configurationfeedInfo - partially complete FeedInfo object
for the feed. The URL is guaranteed to be
present, but no other fields are.
CurnException - on errorCurnConfig,
FeedInfo,
FeedInfo.getURL()
public boolean runPostFeedParsePlugIn(FeedInfo feedInfo,
RSSChannel channel)
throws CurnException
runPostFeedParsePlugIn in interface PostFeedParsePlugInfeedInfo - the FeedInfo object for the feed that
has been downloaded and parsed.channel - the parsed channel data
CurnException - on errorRSSChannel,
FeedInfo
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||