import json
import bson.json_util as bju
import emission.core.get_database as edb
import sys

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print "Usage: %s <filename>" % (sys.argv[0])

    fn = sys.argv[1]
    print "Loading file " + fn
    entries = json.load(open(fn), object_hook = bju.object_hook)
    for entry in entries:
        edb.get_timeseries_db().save(entry)

@@ -85,16 +85,44 @@
 port sys
+%0Aimport argparse%0Aimport uuid
 %0A%0Aif __n
@@ -150,136 +150,580 @@
     
-if len(sys.argv) != 2:%0A        print %22Usage: %25s %3Cfilename%3E%22 %25 (sys.argv%5B0%5D)%0A%0A    fn = sys.argv%5B1%5D%0A    print %22Loading file %22 + fn
+parser = argparse.ArgumentParser()%0A    parser.add_argument(%22timeline_filename%22,%0A        help=%22the name of the file that contains the json representation of the timeline%22)%0A    parser.add_argument(%22-u%22, %22--user_uuid%22,%0A        help=%22overwrite the user UUID from the file%22)%0A    args = parser.parse_args()%0A    fn = args.timeline_filename%0A    print fn%0A    print %22Loading file %22 + fn%0A    tsdb = edb.get_timeseries_db()%0A    override_uuid = None%0A    if args.user_uuid is not None:%0A        override_uuid = uuid.uuid3(uuid.NAMESPACE_URL, %22mailto:%25s%22 %25 args.user_uuid.encode(%22UTF-8%22))
 %0A   
@@ -818,39 +818,104 @@
         
-edb.get_timeseries_db()
+if args.user_uuid is not None:%0A            entry%5B%22user_id%22%5D = override_uuid%0A        tsdb
 .save(en

Support loading with a specified username so that we can test more easily