HenryQW/mercury_fulltext

Apply to All Feeds vs. Setting One by One?

mattpanther opened this issue · 1 comments

Hello, I have the plugin successfully installed and API key saved, is there a way for me to apply the Mercury Parser to all feeds by default vs. going into the plugin settings for each one individually where I'd like to use it?

Hi @mattpanther, unfortunately not.

The logic is simple:

  1. A SQL query to get the list of feed ids from ttrss_feeds table
  2. A PHP function to populate every feed id into a format
  3. A SQL query to insert the generated string into the content field of ttrss_plugin_storage, where the record name is mercury_fulltext and owner_uid is your id.

The content should look like this:

a:2:{s:13:"enabled_feeds";a:3:{i:0;i:5;i:1;i:10;;i:2;i:15;}s:11:"mercury_API";s:40:"your api key";}

The key part is an array a:3:{i:0;i:5;i:1;i:10;;i:2;i:15;}, which assumes you have 3 feeds (a:3) with ids of 5, 10, 15 each after its index position in the array.

So in short, there has to be a logic to generate the following: a:2:{s:13:"enabled_feeds";a:[number of feeds]:{i:0;i:[feed id];i:1;i[feed id];i:2;i:[feed id];}s:11:"mercury_API";s:40:"your api key";}

I haven't got the time to add the described logic, so PR is welcome. I will visit this once I'm free.