ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.32k stars 512 forks source link

How can I store the data directly into my own database? #1020

Closed jiojiojackson closed 5 months ago

jiojiojackson commented 5 months ago

How can I store the data directly into my own database? For example, MySql

github-actions[bot] commented 5 months ago

Hi there! As you're new to this repo, please make sure you've used an appropriate issue template and searched for duplicates (it helps us focus on actual development!). We'd also like to suggest that you read our contribution guidelines and our code of conduct. Thanks a bunch for opening your first issue! 🙏

BelKed commented 5 months ago

If you are familiar with Python, you can use the aw-client library to retrieve the data from ActivityWatch. After processing the data in the Python script, you can use another library to communicate with your MySQL database to store the data there.

If you want to use any other programming language, you can connect to ActivityWatch via the API and the process would be similar.


If you want to avoid using the ActivityWatch server altogether, you can listen on the default ActivityWatch port (5600) where all watchers send their data, and then store the data in your database.