Created
January 12, 2019 23:18
-
-
Save craigeley/523bdbab38fccdd84e7ce59873ab9e2e to your computer and use it in GitHub Desktop.
This app parses the Arc iOS app's GPX exports and sends location to the Day One journaling app. You must have the Day One command line interface installed and set the path to your GPX files on line 8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/opt/ruby/bin/ruby | |
# Scipt to send Arc locations to Day One | |
require 'nokogiri' | |
require 'time' | |
require 'json' | |
filepath = "/Path/to/files/#{ARGV[0]}.gpx" | |
f = File.open(filepath) | |
gpxdoc = Nokogiri::XML(f) | |
gpxdoc.css("wpt").each do |point| | |
lat = point.attr("lat") | |
lon = point.attr("lon") | |
place = point.css("name").text.strip | |
t = point.css("time").text | |
time = Time.parse(t) | |
iso = time.utc.iso8601 | |
`dayone2 new "## #{place}\n\n" -j Inbox -isoDate #{iso} --coordinate #{lat} #{lon}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment