Log anything you add to a folder to Day One. Ideal to use with IFTTT. Inspired in Sifttter and Slogger.
DayOneLogger is an script that runs daily (or in the time period you define) and automatically checks for new entries on different files in the defined directory. The files must contain an specific format:
<date>|~|<any extra content defined by the parsers>@done
The date need to be in the format September 05, 2014 at 03:06PM
(the one used by IFTTT).
The separator |~|
is just to separate each content of the entry. You can add as many separators as you need, later the parser will do the magic understanding what each content means.
And finally you need to add the ending token identified as @done
, to inform the parsers where an entry finish.
Example from a completed reminder in Reminders iOS app:
September 05, 2014 at 03:05PM|~|Reminders|~|Buy milk @done
The script only stores on Day One all entries from previous day and before, it's intentionally done to avoid miss last time entries.
It also logs previous unimported days.
The resulting entry looks like:
Clone the repository:
git clone https://github.com/lardissone/DayOneLogger.git
The only requirement is the beautiful Arrow library, but if you want more control you can install it using a virtualenv
.
Install requirements (requires pip
):
pip install -r requirements.txt
You need to edit a few settings in the source of the dayone.py
file:
-
IFTTT_DIR
: set the relative directory to where you store the logging files -
DAYONE_DIR
: uncomment the corresponding option. If you have syncing with iCloud or Dropbox. -
TIME_ZONE
: set your local timezone to include the correct time. You can find the list of all timezones in Wikipedia. Note: it should be automatic, buttzlocal
library doesn't works well in OSX with some specific zones. -
TIME_ZONE_OFFSET
: it's the number of difference in hours fromUTC
. It's also something we should calculate automatically, probably in the future. -
ENTRY_TAGS
: a list with the tags to be used in each entry. -
SERVICES
: a list with the services you want to process. Review each service file in theservices
folder in case you need to do custom modifications, actual services are:SERVICES = [ 'github', 'reminders', 'movies', 'places', 'tracks', 'tweets', 'wakatime', 'todoist',]
To run the script you just need to call it from the terminal by using:
python dayone.py
To make it effective you should add it to a cron or launchd script.
Currently here are a few of parsers I've created for my pleasure, all of them uses IFTTT to generate the data from my other services.
You can simply use any of these recipes with your services. Remember to change the settings according to your setup.
Use your activity atom feed URL, which is: https://github.com/yourusername.atom
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log all your completed tasks in the Reminders app. You need the IFTTT app installed in your phone.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log all your Twitter activity.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
It's a little more tricky to obtain. Log in to IMDb, and go to your Ratings, and you'll see the feed icon to the upper right of the page, use this URL.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log all the places you visits.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log all your loved tracks.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log all the tasks you've completed.
<script async type="text/javascript" src= "//ifttt.com/assets/embed_recipe.js"></script>
Log how much time did you spend in each project using Wakatime.
You need to create an environment variable called WAKATIME_API_KEY
with your Wakatime API key, or add it to the services/wakatime.py
file.
- Add tests
- Add documentation about launchd, cron, etc.
- Isolate parsers
- Allow editing previous entries
- Find a way to get current timezone in OSX.
tzlocal
library is pretty buggy with some locations
This simple script was created by Leandro Ardissone. Feel free to contact me on Twitter or leave issues in github with suggestions/bugs/etc.