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

Plug-in API #80

Closed
lemon24 opened this issue Jul 23, 2018 · 3 comments
Closed

Plug-in API #80

lemon24 opened this issue Jul 23, 2018 · 3 comments
Labels

Comments

@lemon24
Copy link
Owner

lemon24 commented Jul 23, 2018

There are things that are hardcoded and might work better as plug-ins. This issue is to catalogue these things, and eventually do something about them (or not).

The main things one would need to hook into are the Reader, the web app, and the CLI.

Enclosure tag proxy

Hooks into:

  • web app: additional link in the enclosure
  • web app: additional view/route

serve command

Hooks into:

  • CLI

Requests parser

Should remain the only parser (so, not a plug-in).

Hooks into:

  • Reader: reader._parse()

Tumblr GDPR plug-in

Hooks into:

  • Reader: RequestsParser.response_plugins (functions called on response after it's retrieved)

Duplicate enclosure removal

For #78.

Hooks into:

  • Reader
    • reader.get_entries(), or
    • reader._parse()

Duplicate entry removal

For #79.

Hooks into:

  • Reader
    • reader.get_entries(), or
    • reader._parse()

Either would probably need direct access to the database, and possibly some way to store metadata.

Feed user titles

Hooks into:

  • Reader
    • additional methods
    • feed metadata (database and type)
    • reader.get_entries()
    • reader.get_feed()
  • web app
    • feed title (if Feed has a user_title attribute)
    • control to update feed title

Read/unread entry status

This is part of the core functionality, but could be modeled as a plugin (shouldn't, though; listing it here for completeness).

Hooks into:

  • Reader
    • additional methods
    • entry metadata (database and type)
  • web app
    • controls to mark (all) as read/unread

Metrics

For #68.

Hooks into:

  • all public methods, or
  • special private methods called by all public methods

regex_mark_as_read plugin

For #79.

Hooks into:

  • (now) hook called for each added entry, after it is added
  • (better) hook called for each added entry, before it is added (so it can be mutated)

feed_entry_dedupe plugin

For #79.

Hooks into:

  • (now) hook called for each added entry, after it is added
  • (better) hook called for each added entry, after it is added, but allowing the plugin to cache data during a single update_feed(s) call
@lemon24 lemon24 added the API label Jul 23, 2018
@lemon24
Copy link
Owner Author

lemon24 commented Jul 31, 2018

This gist shows how one can use setuptools entry points to detect all available plug-ins, and how to load specific plug-ins from a config file.

@lemon24
Copy link
Owner Author

lemon24 commented Apr 2, 2020

If we ever outgrow our home-grown plugin loader, consider giving https://pluggy.readthedocs.io/en/latest/ a look.

@lemon24
Copy link
Owner Author

lemon24 commented Oct 12, 2021

We already have a few hooks (after_entry_update_hooks, after_feed_update_hooks), and support for callable plugins in make_reader(..., plugins=...).

Next steps:

Closing this issue, since all of these will be done later.

@lemon24 lemon24 closed this as completed Oct 12, 2021
lemon24 added a commit that referenced this issue Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant