hamster-time-tracker utility belt 🐹👷
Go to file
2023-11-01 21:11:21 +00:00
hamstertools Break out sync to separate file 2023-11-01 21:11:21 +00:00
scripts Move debugging output to -d option 2023-11-01 20:56:04 +00:00
.gitignore Tweak README, ignore data/, add requirements 2022-03-01 14:22:31 +02:00
README.md Support multiple mapping files 2023-07-08 13:13:07 +01:00
requirements.txt Tweak README, ignore data/, add requirements 2022-03-01 14:22:31 +02:00
setup.py Tweak reqs, add rename_category, etc. 2021-09-07 23:53:36 +02:00

hamster-tools

Manipulate hamster-time-tracker data from the command-line, including:

  • find duplicate activities
  • list, move and delete categories, activities and facts

Merging, renaming and otherwise tidying-up the database used to be possible in the Hamster GUI, but currently (as of version 2.0.0.16) doesn't work for me, so I wrote this script to fill in the gap until the shiny new version of hamster is ready.

$ pip install .

$ hamster-tools categories --help
Usage: hamster-tools categories [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  activities  Show activities for categories specified by IDS
  delete      Delete categories specified by IDS
  list        List / search categories
  tidy        Delete empty categories

$ hamster-tools activities --help
Usage: hamster-tools activities [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  delete           Delete activities specified by IDS
  find-duplicates  Show activities which are not unique in their categories
  list             List / search activities
  list-facts       Show facts for activities
  move             Move activities to another category
  move-facts       Move facts from one activity to another

$ hamster-tools export 
Usage: hamster-tools export [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  kimai  Export time tracking data in Kimai format

Importing into Kimai

  1. Run python -m hamstertools activities list --csv to get a dump of all activities
  2. Review the export to check for any duplicates, typoes, etc.
  3. Use e.g. python -m hamstertools activities move-facts ... to clean them up
  4. Run python -m hamstertools kimai import --mapping-path data/mapping.2023.kimai.csv --show-missing --after 2023-09-07 --category-search auto 3wordchant to find entries in your time tracking which don't yet have a mapping to Kimai. You might notice some extra tidying needed here.
  5. Run python -m hamstertools kimai sync --mapping-path data/mapping.2023.kimai.csv --just-errors --ignore-activities 3wordchant $(pass users/calix/logins/kimai.autonomic.zone/api) to find items in your mapping file which don't exist on Kimai
  6. Run python -m hamstertools kimai import --mapping-path data/mapping.2023.kimai.csv --after 2023-09-07 --category-search auto 3wordchant --output data/kimai_$(date +%F).csv to generate a CSV of your time entries
  7. Review your timesheet -- NB it might not be sorted in date order by default - to make sure it has the expected entries, and remove any entries already in Kimai.