use start timestamp for file prefix
This commit is contained in:
parent
d17df2fc6c
commit
3cf73594fc
@ -4,6 +4,7 @@
|
|||||||
import codecs
|
import codecs
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
import dateutil.parser
|
||||||
import os
|
import os
|
||||||
|
|
||||||
export_formats=["json_summary", "json_details", "gpx", "tcx", "fit"]
|
export_formats=["json_summary", "json_details", "gpx", "tcx", "fit"]
|
||||||
@ -31,10 +32,9 @@ def export_activity(client, activity_id, destination,
|
|||||||
activity_summary = client.get_activity_summary(activity_id)
|
activity_summary = client.get_activity_summary(activity_id)
|
||||||
|
|
||||||
# prefix saved activity files with timestamp and activity id
|
# prefix saved activity files with timestamp and activity id
|
||||||
creation_millis = activity_summary["activity"]["uploadDate"]["millis"]
|
start = activity_summary["activity"]["activitySummary"]["BeginTimestamp"]["value"]
|
||||||
timestamp = datetime.fromtimestamp(int(creation_millis)/1000.0)
|
timestamp = dateutil.parser.parse(start)
|
||||||
filename_prefix = "{}_{}".format(
|
filename_prefix = "{}_{}".format(timestamp.isoformat(), activity_id)
|
||||||
timestamp.strftime("%Y%m%d-%H%M%S"), activity_id)
|
|
||||||
path_prefix = os.path.join(destination, filename_prefix)
|
path_prefix = os.path.join(destination, filename_prefix)
|
||||||
|
|
||||||
if 'json_summary' in formats:
|
if 'json_summary' in formats:
|
||||||
|
@ -1 +1,2 @@
|
|||||||
requests==2.4.3
|
requests==2.4.3
|
||||||
|
python-dateutil==2.2
|
||||||
|
Loading…
Reference in New Issue
Block a user