summaryrefslogtreecommitdiff
path: root/scripts/tellico2lesana
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-08-11 11:25:44 +0200
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2019-08-11 11:25:44 +0200
commit53f116abd38f47ef9f51d2fd0e65515e89c9b9be (patch)
treefd88cef4718d4b2774e672cb8de0b102f2af97a7 /scripts/tellico2lesana
parentfcd687b5d8abf51fe046b80afe5cd7d15ca880e2 (diff)
Stop using guacamole (no longer in Debian)
Diffstat (limited to 'scripts/tellico2lesana')
-rwxr-xr-xscripts/tellico2lesana27
1 files changed, 10 insertions, 17 deletions
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()