fasheng / elfeed-protocol

Provide extra protocols to make like Fever, NewsBlur, Nextcloud/ownCloud News and Tiny Tiny RSS work with elfeed
GNU General Public License v3.0
100 stars 18 forks source link

Elfeed not pulling read state #28

Closed ivantomica closed 4 years ago

ivantomica commented 4 years ago

I have "fever" API configured for elfeed-protocol and syncing works just fine. When I read articles with elfeed read state is successfully synced back to my Miniflux instance (providing fever api).

Issue is when I mark some article as read in web interface of Miniflux or via Mobile app, then this read state is not propagated back to elfeed.

Turning on detailed log gives many things which I'd rather not share here in bug report, but one thing I can confirm that entry marked as read in web interface is no longer in curl output when fetching article ids, so it would appear that the issue is with elfeed not updating read state in its own database.

Is there a way to fix this behavior so if state is changed outside of the elfeed, it gets propagated to elfeed db as well?

fasheng commented 4 years ago

Well, only ownCloud News API support two-way synchronization for it fetch articles with modified time. And other API only fetch articles id by id. So your issue just the desired result~

ivantomica commented 4 years ago

Correct. Is there perhaps a way to compare id's pulled by fever API with those in database and mark differences as read (remove unread tag)?

Not sure how that would reflect performance in really huge lists, but I guess nobody has multiple-thousands of entries for this to be a concern.

fasheng commented 4 years ago

You could reset the update mark so it will re-fetch the last 1000 articles in following updates and will sync the read state.

(let* ((proto-id "fever+https://user@miniflux-host")
       (last-id (elfeed-protocol-fever-get-update-mark proto-id 'update)))
  (elfeed-protocol-fever-set-update-mark  proto-id 'update (- last-id 1000)))

And Fever limit 50 max size for per request, so update timer may help you.

(run-at-time 300 300
             (lambda () (when (= elfeed-curl-queue-active 0)
                          (elfeed-update))))

Or you could use elfeed-untag-1 mark all selected articles as read(will not call curl) then elfeed-protocol-fever-reinit fetch all unread articles

(cl-loop for entry in (elfeed-search-selected)
         do (elfeed-untag-1 entry 'unread))

Hope helps.

ivantomica commented 4 years ago

Very much so. Thank you for the help!

ivantomica commented 4 years ago

Sorry for pinging here again. I've tried following so far in order to achieve this by defining my custom function:

   (defun my/elfeed-refresh ()
     (interactive)
     (mark-whole-buffer)
     (cl-loop for entry in (elfeed-search-selected)
          do (elfeed-untag-1 entry 'unread))
     (elfeed-search-update--force)
     (elfeed-protocol-fever-reinit "fever+https://REDACTED"))

Unfortunately this results with following error:

[2020-03-07 14:33:25] [debug]: elfeed-protocol-fever: update feed list
[2020-03-07 14:33:25] [debug]: retrieve (?api&feeds)
[2020-03-07 14:33:25] [error]: ?api&feeds: "(3) URL malformed. The syntax was not correct."

It would appear as URL is not properly set. But when I interactively call this function with: M-x elfeed-protocol-fever-reinit

And it prompts me for URL, I tab-complete same fever+https://REDACTED URL and then log message prints proper URL:


[2020-03-07 14:35:02] [debug]: retrieve (https://REDACTED/fever/?api&feeds)
[2020-03-07 14:35:03] [debug]: elfeed-protocol-fever:
...

Please accept apologies for my lack on knowledge in elisp. I know this isn't something thats directly related to your package but any help would be appreciated. 
fasheng commented 4 years ago

Use (elfeed-protocol-fever-reinit "https://REDACTED") instead.