WhatPulse Forums
[Feature Req] Expose stats via command line - Printable Version

+- WhatPulse Forums (https://whatpulse.org/forums)
+-- Forum: Feature requests (https://whatpulse.org/forums/forum-32.html)
+--- Forum: Client software (https://whatpulse.org/forums/forum-44.html)
+--- Thread: [Feature Req] Expose stats via command line (/thread-4617.html)



[Feature Req] Expose stats via command line - SnoFox - 03-14-2014

Hi there,

Feature Request
Expose the geek window counts on the command line via switches in the binary

Rationale
Integration with existing information display applications, such as Geektool (Mac OS X) and Conky (Linux).

Example execution
$ ./whatpulse --getstat LocalKeys
LocalKeys: 1083
$ ./whatpulse --getstat LocalKeys,TotalKeys
LocalKeys 1083
TotalKeys 39935764

Other thoughts
This basic form, or even a more basic form is all the information a Mac/Linux user would need to awk out what they want and throw it into Geektool.

Edit: Er ... Alternatively I can just hit your Web API with a little NodeJS script.

I found out that exists a few seconds ago. I'm going to leave this post here though, just because, y'know, hitting your API every few seconds for Conky sounds like a load you guys don't want. ;]


RE: [Feature Req] Expose stats via command line - smitmartijn - 03-14-2014

Have a look at the open sqlite database the client uses. It's a bit of an underlit feature because I'm still working on some examples for developers, but the tables 'settings' and 'unpulsed_stats' will be of interest for you.

Also, querying the API is pretty useless, as 1) it has an hourly cache and 2) it only changes when you pulse.


RE: [Feature Req] Expose stats via command line - SnoFox - 03-14-2014

Ahh, very nice. Will (ab)use this for my needs. Thanks :]


RE: [Feature Req] Expose stats via command line - montythefish - 03-24-2014

I'm trying to open whatpulse.db in ~/.local/share/data/WhatPulse/ but it is apparently either encrypted or not a database. I can, however, open whatpulse.db.backup. Is this intentional? If so, how are we supposed to access the database? I understand you probably don't want us to fake stats, but the way you said "Have a look at the open sqlite database the client uses" makes me think I'm missing something and I should be able to get current stats from the database.


RE: [Feature Req] Expose stats via command line - smitmartijn - 03-24-2014

It's not encrypted and you should be able to open it via sqlite itself just fine. Make sure you have the whatpulse.db file, not the whatpulse.wpw file.

whatpulse.wpw is the encrypted file in which the pulse stats reside. Any stats you're going to 'fake' inside the whatpulse.db are local only...so if you want to have fun that way, go ahead. ;-)


RE: [Feature Req] Expose stats via command line - montythefish - 03-24-2014

Alright I got this figured out for the most part. How often does whatpulse update the whatpulse.db? I'd like to check it as often as possible, but it doesn't seem to change more often than every 60 seconds. Can I force whatpulse to update the database more often?


RE: [Feature Req] Expose stats via command line - smitmartijn - 03-25-2014

(03-24-2014, 05:03 PM)montythefish Wrote: Can I force whatpulse to update the database more often?

Nope. That has to do with caching and database operations, which we've limited to spare disk operations.