Changeset 9173 for src/django_gheat/gheat/management
- Timestamp:
- May 10, 2011, 1:44:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/django_gheat/gheat/management/commands/import_kismet.py
r9169 r9173 9 9 from lxml import etree 10 10 import datetime 11 import gzip 11 12 import os 12 13 import sys 13 14 14 15 def import_file(gpsxml_file, netxml_file, meetrondje, gebruiker, email): 15 gpsxml_doc = etree.parse(gpsxml_file) 16 netxml_doc = etree.parse(netxml_file) 16 open_file = lambda file: gzip.open(file,'rb') if file.endswith('.gz') else open(file,'rb') 17 gpsxml_doc = etree.parse(open_file(gpsxml_file)) 18 netxml_doc = etree.parse(open_file(netxml_file)) 17 19 18 20 points = gpsxml_doc.findall('gps-point') … … 87 89 88 90 class Command(BaseCommand): 89 args = '<gpsxml> [<netxml>]'91 args = '<gpsxml>[.gz] [<netxml>[.gz]]' 90 92 option_list = BaseCommand.option_list + ( 91 93 make_option('-m', '--meetrondje', dest='meetrondje', default='rondje',help='Naam van het meetrondje'), … … 100 102 elif len(args) == 1: 101 103 (gpsxml_file,) = args 102 netxml_file = gpsxml_file [:-6] + 'netxml'104 netxml_file = gpsxml_file.replace('.gpsxml','.netxml') 103 105 else: 104 106 raise ValueError
Note:
See TracChangeset
for help on using the changeset viewer.