How to get the number of unread articles directly from DB ?

Howtos, instructions and links to related software. Do not ask questions here.
szafran
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 08 Jun 2013, 23:52

How to get the number of unread articles directly from DB ?

Postby szafran » 09 Jun 2013, 00:01

Hi,

I'd like to know how can I construct a MySQL query to get the number of unread articles for a specific user ?
I'm using lcd4linux to display some data from my NAS, and I'd like to add the unread article info to it.

Thanks in advance for any help.

_______
Szafran

feader
Bear Rating Master
Bear Rating Master
Posts: 160
Joined: 26 Dec 2012, 20:03

Re: How to get the number of unread articles directly from D

Postby feader » 09 Jun 2013, 00:31

It's not a SQL request, but if needs be, you can search the code base (or take a look at the DB) to construct one.

Code: Select all

<http://your.ttrss-server.tld>/public.php?op=getUnread&fresh=1&login=<username>

I think it returns a JSON object, so you may need to parse the return value.

szafran
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 08 Jun 2013, 23:52

Re: How to get the number of unread articles directly from D

Postby szafran » 09 Jun 2013, 01:05

I think I've allready found the answer:

Code: Select all

SELECT SUM(value) AS unread FROM ttrss_counters_cache WHERE owner_uid = '1' AND feed_id > 0


Just have to check if it works, but I think it should be ok.

AngryChris
Bear Rating Master
Bear Rating Master
Posts: 135
Joined: 08 Apr 2013, 02:42

Re: How to get the number of unread articles directly from D

Postby AngryChris » 09 Jun 2013, 07:08

Code: Select all

SELECT count(*) FROM ttrss_user_entries WHERE owner_uid='2' AND last_read IS NULL;

Replace the value of owner_uid with the correct one as taken from the ttrss_users table.

szafran
Bear Rating Trainee
Bear Rating Trainee
Posts: 6
Joined: 08 Jun 2013, 23:52

Re: How to get the number of unread articles directly from D

Postby szafran » 09 Jun 2013, 12:39

Thank you very much.


Return to “Knowledge Base”

Who is online

Users browsing this forum: No registered users and 0 guests