diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-04-22 19:24:42 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-04-22 19:24:42 +0200 |
commit | fd0b9834b09d4afe5bdaccc42e3e5c73d64d25d6 (patch) | |
tree | 06f99279b2010454b18660139a518165d02a0762 /scripts/tellico2lesana | |
parent | 573411b3d1248fb1bb8b58f4143dc223aea2cc85 (diff) |
tellico2lesana: create a lesana collection
Diffstat (limited to 'scripts/tellico2lesana')
-rwxr-xr-x | scripts/tellico2lesana | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/scripts/tellico2lesana b/scripts/tellico2lesana index 8de8bf9..e820069 100755 --- a/scripts/tellico2lesana +++ b/scripts/tellico2lesana @@ -3,6 +3,8 @@ from xml.etree import ElementTree import zipfile +import lesana + import guacamole @@ -31,8 +33,13 @@ class T2L(guacamole.Command): def register_arguments(self, parser): parser.add_argument( + '-c', '--collection', + help='Name of the new lesana collection', + default=None, + ) + parser.add_argument( 'file', - help='Tellico file to convert to lesana.' + help='Tellico file to convert to lesana.', ) def invoked(self, ctx): @@ -54,9 +61,19 @@ class T2L(guacamole.Command): 'name': xf.attrib['title'], 'type': f_type, }) - # TODO: create a collection with the following settings: - import ruamel.yaml - print(ruamel.yaml.dump({'title': title, 'fields': fields})) + # Create a collection with the settings we have loaded + directory = ctx.args.collection or ctx.args.file.replace( + '.tc', + '.lesana' + ) + lesana.collection.Collection.init( + directory=directory, + git_enabled=False, + settings={ + 'name': title, + 'fields': fields, + } + ) # import data |