From 53f116abd38f47ef9f51d2fd0e65515e89c9b9be Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sun, 11 Aug 2019 11:25:44 +0200 Subject: Stop using guacamole (no longer in Debian) --- scripts/tellico2lesana | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'scripts/tellico2lesana') diff --git a/scripts/tellico2lesana b/scripts/tellico2lesana index 6f9cc5a..0d16ad4 100755 --- a/scripts/tellico2lesana +++ b/scripts/tellico2lesana @@ -6,8 +6,6 @@ import zipfile import lesana -import guacamole - NS = {'tellico': 'http://periapsis.org/tellico/'} @@ -28,21 +26,19 @@ F_TYPE_MAP = { } -class T2L(guacamole.Command): +class T2L(lesana.command.Command): """ Manage collections """ - - def register_arguments(self, parser): - parser.add_argument( - '-c', '--collection', + arguments = [ + (['-c', '--collection'], dict( help='Name of the new lesana collection', default=None, - ) - parser.add_argument( - 'file', + )), + (['file'], dict( help='Tellico file to convert to lesana.', - ) + )), + ] def read_field_data(self, xfield): if xfield.tag in self.date_fields: @@ -69,9 +65,8 @@ class T2L(guacamole.Command): data = xfield.text return data - - def invoked(self, ctx): - with zipfile.ZipFile(ctx.args.file, 'r') as zp: + def main(self): + with zipfile.ZipFile(self.args.file, 'r') as zp: tree = ElementTree.parse(zp.open('tellico.xml')) # open collection xml_collection = tree.getroot().find('tellico:collection', NS) @@ -109,7 +104,7 @@ class T2L(guacamole.Command): field['list'] = l_type fields.append(field) # Create a collection with the settings we have loaded - directory = ctx.args.collection or ctx.args.file.replace( + directory = self.args.collection or self.args.file.replace( '.tc', '.lesana' ) @@ -137,7 +132,5 @@ class T2L(guacamole.Command): self.collection.update_cache() - - if __name__ == '__main__': T2L().main() -- cgit v1.2.3