diff options
-rwxr-xr-x | scripts/tellico2lesana | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/tellico2lesana b/scripts/tellico2lesana index 0d16ad4..4bd0810 100755 --- a/scripts/tellico2lesana +++ b/scripts/tellico2lesana @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import argparse import datetime from xml.etree import ElementTree import zipfile @@ -26,7 +27,7 @@ F_TYPE_MAP = { } -class T2L(lesana.command.Command): +class T2L(): """ Manage collections """ @@ -40,6 +41,12 @@ class T2L(lesana.command.Command): )), ] + def _load_args(self): + self.parser = argparse.ArgumentParser() + for arg in self.arguments: + self.parser.add_argument(*arg[0], **arg[1]) + self.args = self.parser.parse_args() + def read_field_data(self, xfield): if xfield.tag in self.date_fields: for child in xfield: @@ -66,6 +73,7 @@ class T2L(lesana.command.Command): return data def main(self): + self._load_args() with zipfile.ZipFile(self.args.file, 'r') as zp: tree = ElementTree.parse(zp.open('tellico.xml')) # open collection |