2 """Convert a bkmk database to a different storage.
4 This file is a part of Bookmarks database and Internet robot.
7 __author__ = "Oleg Broytman <phd@phdru.name>"
8 __copyright__ = "Copyright (C) 2000-2012 PhiloSoft Design"
9 __license__ = "GNU GPL"
15 from getopt import getopt
16 optlist, args = getopt(sys.argv[1:], "s")
20 for _opt, _arg in optlist:
29 sys.stderr.write("convert_st: too many or too few arguments\n")
30 sys.stderr.write("Usage: convert_st [-s] new_storage\n")
33 from bkmk_objects import parse_params, set_params
34 from storage import storage, import_storage
38 storage_name, storage_params = parse_params(args[0])
39 new_storage = import_storage(storage_name)
40 set_params(new_storage, storage_params)
41 new_storage = new_storage()
44 sys.stdout.write("Loading %s: " % storage.filename)
47 root_folder = storage.load()
51 sys.stdout.write("Converting to %s: " % new_storage.filename)
54 new_storage.store(root_folder)
60 if __name__ == '__main__':