Activitywatch: merge several hosts into one?

Created on 13 Jul 2020  路  4Comments  路  Source: ActivityWatch/activitywatch

  • [x] I am on the latest ActivityWatch version.
  • [x] I have searched the issues of this repo and believe that this is not a duplicate.
  • MacOS Big Sur 11.0 Beta (20A4299v):
  • ActivityWatch 0.9.2:

Describe the bug

image
I have several "hosts" under Activity menu. Is there any way to merge them?

bug

Most helpful comment

@alexriabtsev I think you could do that by exporting everything to JSON, cutting all of the events from one bucket and pasting them under the other, deleting the unnecessary buckets, and reimporting. This would be simplest, quickest way. More advanced ways would be to read JSON into python script and do the same changes there programmatically, or by changing the bucket_id directly in the database using SQL queries

Note: If these hosts ever ran in parallel, there may be issues because you have multiple events occurring simultaneously.

All 4 comments

It is possible by exporting changing the export file and then importing, but not in the UI.

We have not implemented this yet because it hasn't been an issue and if merging buckets wrongly it will create broken data so it is an action which needs to be done with caution.

@johan-bjareholt thanks for reply!
How can I do that via export/import? docs?

@alexriabtsev I think you could do that by exporting everything to JSON, cutting all of the events from one bucket and pasting them under the other, deleting the unnecessary buckets, and reimporting. This would be simplest, quickest way. More advanced ways would be to read JSON into python script and do the same changes there programmatically, or by changing the bucket_id directly in the database using SQL queries

Note: If these hosts ever ran in parallel, there may be issues because you have multiple events occurring simultaneously.

I wrote a Python script that inserts all events from one bucket into another bucket, after checking for overlap (which you shouldn't have if it was caused by a changing hostname): https://github.com/ActivityWatch/aw-client/pull/50

I used it for my duplicate buckets caused by a changing hostname, and it seems to work fine but please backup your stuff before running.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ErikBjare picture ErikBjare  路  7Comments

ErikBjare picture ErikBjare  路  9Comments

TheOrigins picture TheOrigins  路  6Comments

austil picture austil  路  3Comments

ankushdas9 picture ankushdas9  路  8Comments