Today was my weekly Team in Training run — I’m training for and planning to run a marathon to raise money for blood cancer research — and 6.61 miles into the run, my iPod Nano froze on me for the first time in the month that I’ve had it (yes, it let me down after I raved about it in my last post). I was really upset that I was not only going to lose my run data, but that I wouldn’t get the mileage credit for the Articulate miles challenge. I ended up doing another 2+ miles for a total of 8.78 miles.
So on my drive home from the run, aside from being bummed, I started thinking about how to fix this. I thought that there had to be some way to hack into the iPod to recover my lost run data — or at least simulate the run based on similar run data.
Sure enough, I was right: My run data was lost during the iPod crash, but I was given the opportunity to tackle a fun technology challenge.
I got home and started doing some Google searches to research the topic before I just started digging into my iPod’s hard drive. I found a couple resources with the info I needed — “MadeUpName’s” method outlined on runpl.us and WalkBlogRun’s method here — and pieced together my own approach that did the trick beautifully.
Here’s how I did it — proceed with caution and at your own risk to your data and software:
Hacking your iPod’s run data requires that you create and edit XML files, so before you can do that, you need to confirm two things (both were already the case for me):
- Make sure iPod is set to be a disk (check the Enable disk use box on your iPod Summary tab in iTunes).
- Make sure you can see hidden system files & folders in Windows (XP how-to | Vista how-to).
As is the case whenever you’re editing pretty much anything — especially files that help drive your iPod and iTunes software — always make a backup first since you never know what might happen:
- Connect your iPod to your computer.
- Navigate to this path (yours may vary):
- Copy the entire contents of that folder to your hard drive (2 folders — latest and synched, and 5 files — best, calibration, settings.plist, lastWorkout.xml, and preferences.xml).
Now that you’ve backed up the key files, you’re ready to get down ‘n dirty. It just so happened that, in my case, the run I did today was the same run I did a couple weeks ago (February 16) in terms of location, mileage, and rough pace. So that made copying the run data fairly easy. Along with that, I also wanted to ensure my last workout and workout summary data were correct.
So there are 3 things you need to do:
- Create or copy your new run data (the XML file named after the date & completion time of your run — e.g., 2008-03-02 08;14;25.xml — that’ll begin with the <sportsData> tag inside the file) to your latest folder.
- Update your lastWorkout.xml file.
- Update your preferences.xml file.
Those last two files are used to display your run summary data in both iTunes and in your iPod. Here’s what the screen with that info looks like in iTunes:
So here’s what I did for each of the above steps:
1. Copying run data.
The first thing I needed to do was to re-create today’s lost run data file by duplicating the data for the last time I did the run and update it with today’s date:
- Opened the synched folder and located the data file for the last time I did this run (2008-02-16 08;14;25.xml).
- Copied 2008-02-16 08;14;25.xml to my desktop.
- Opened 2008-02-16 08;14;25.xml with Notepad.
- Located the two references to the date & time of the run — in the <time> and <startTime> tags — and changed the values to today’s date (run start time was the same today and last time I did the run):
- Saved the file & renamed it to match today’s date and run finish time (2008-03-02 08;14;25.xml).
- Copied this new file to the latest folder on my iPod — the staging area for runs that have yet to be snyched with iTunes.
Note: I left all other run data the same in my run data file, but you’ll see that you can update all kinds of data to match your estimated values for your run, including these:
- <distance> (in both km and miles)
You’ll also notice in the middle of your run data file that your iPod records your run distance every 10 seconds. Pretty cool stuff.
2. Updating lastWorkout.xml.
Next, I needed to copy key portions of today’s run data to the lastWorkout.xml file, so here’s what I did:
- Opened up both 2008-03-02 08;14;25.xml and lastWorkout.xml in Notepad.
- In my run data file, copied from the beginning of the <time> tag to the end of the <lifetime> tag; this includes all the relevant data you need to paste into lastWorkout.xml.
- Pasted this data into lastWorkout.xml, overwriting the existing values, of course.
- Referred to my last run data XML file to update lifetime stats in this section to include this latest run data.
- Saved lastWorkout.xml.
3. Updating preferences.xml.
Finally, I needed to do some basic math to update my total run data to reflect today’s run:
- Opened both 2008-03-02 08;14;25.xml and preferences.xml in Notepad.
- Incremented my <TotalWorkouts> value by 1 (from 11 to 12).
- Updated the <TotalCalories> value by adding the <calories> value from today’s new run data file.
- Updated the <TotalSeconds> value by taking the <duration> value from my run data file, minus the last 3 digits since your run data files measure to the thousandth of a second (in my case, the <duration> value was 4236763, so I took 4236 and added it to 30529 to get 34765, which, when converted to hours, checks out to be my correct total: 9.6 hours).
- Updated the <TotalDistanceMiles> to include today’s mileage.
- Updated the <TotalWeightWorkouts> value to 12.
- Left everything else — like <FarthestMile> and <TotalMarathon> — the same since my longest distance still stands at 10.02 miles (last Sunday) and since I haven’t yet run a marathon.
- Saved the file.
So that’s it! You’re done with the hard part.
The only thing left to do is to confirm that your hacks worked as expected (you did back up your original files, right?). Here’s what I did to confirm:
- In iTunes, ejected my iPod.
- Unplugged my iPod and went to the Nike+ screen to confirm my latest run and new totals were reflected.*
- Plugged my iPod back into my computer & confirmed latest run & summary data were reflected.
- Synchronized my data and uploaded the run to my Nike+ site (I had to login to my nikeplus site again).
* At first, my summary data was showing up in iTunes, but not in my iPod, so I did a force reset using the method suggested by Apple, and after that, the new summary data appeared as expected.
Success! I learned a fun hack and can now rest assured that my run data — at least the mileage totals — remains (mostly) accurate.
Have fun and remember: If you use this method to fabricate run data, you’re cheating no one but yourself.[ Subscribe to gabeanderson.com via email or RSS feed. ]