Problem
I have some org-mode tables with a column containing the duration (or length) of musical tracks:
|---+---------------------------------+-----------------------------------+----------|
| # | Artist | Title | Duration |
|---+---------------------------------+-----------------------------------+----------|
| 1 | Lorem ipsum dolor sit amet | consectetuer adipiscing elit | 7:32 |
| 2 | Donec hendrerit tempor tellus | Donec pretium posuere tellus | 1:09:27 |
| 3 | Proin quam nisl, tincidunt et | mattis eget, convallis nec, purus | 10:15 |
| 4 | Cum sociis natoque penatibus et | magnis dis parturient montes | 4:25 |
|---+---------------------------------+-----------------------------------+----------|
I'd like to convert the durations to start times. The result of the converstion should look like this:
|---+---------------------------------+-----------------------------------+------------|
| # | Artist | Title | Start time |
|---+---------------------------------+-----------------------------------+------------|
| 1 | Lorem ipsum dolor sit amet | consectetuer adipiscing elit | 0:00 |
| 2 | Donec hendrerit tempor tellus | Donec pretium posuere tellus | 7:32 |
| 3 | Proin quam nisl, tincidunt et | mattis eget, convallis nec, purus | 1:16:59 |
| 4 | Cum sociis natoque penatibus et | magnis dis parturient montes | 1:27:14 |
|---+---------------------------------+-----------------------------------+------------|
Note
In the duration input
- Durations will be given in terms of hours, minutes, and seconds, separated by colons
- leading zeroes may or may not be present (ie. a duration may look like "09:25" or "9:25")
- the hours field may or may not be present (ie. a duration might look like "9:25" or "1:09:25" or even "0:09:25")
In the start time output
- minutes and seconds should always be present, even if they're zero (ex: "0:00" and "0:32" are both correct)
- if the left-most field is not a minute field and is 0, it and the colon following it should be omitted (ie. output "12:24", not "0:12:24")
- a field should be padded with leading zeroes if there is another field to its left (ie. these are all correct: "1:09:26", "1:00:26", "1:00:00", "9:26", and these are wrong: "0:09:26", "00:09:26")