file_index.crc += 2**32 if( file_index.crc != info.CRC ): print "Error:CRC failure in ",filename print "\tGPX crc:",str(file_index.crc) print "\tZIP crc:",str(info.CRC) if( len(text) < 100*1024 ): small_files = small_files + 1 if( small_files == 2 ): print "Warning:multiple small files(<100KiB) in archive" print "\tThese should be combined" if( len(text) > 5*1024*1024 ): print "Warning:large file(>5Mib) in archive:",filename print "\tGPX size:",len(text) print "\tThis should be split into smaller files" file_index.name = filename[5:] gpxindex.filelist.append( file_index ) elif( filename.startswith("index/") ): pass else: print "warning:unknown file in archive:",filename #parse the built-in index indexname = "index/com/garmin/geocaches/v0/index.xml" try: info = z.getinfo(indexname) except KeyError: print 'ERROR: Did not find %s in ggz file' % indexname else: print '%s is %d bytes' % (info.filename, info.file_size) #todo, hook index reader in, verify indexes match
print "Warning:packing multiple small files(<100KiB)" print "\tThese should be combined" if (sz > 5 * 1024 * 1024): print "Warning:large file(>5Mib):", basefile print "\tGPX size:", sz print "\tThis should be split into smaller files" parse_time = time.time() print "\tParsing XML into cachelist" p = GpxParser() f = open(file, "rb") text = f.read() f.close() file_index.cachelist = p.ParseText(text) file_index.crc = crc32(text) file_index.name = os.path.basename(file) print "\tFound %i caches" % (len(file_index.cachelist)) total_caches = total_caches + len(file_index.cachelist) parse_time = time.time() - parse_time print "\tZipping" zip_time = zip_time - time.time() z.write(file, "data/" + basefile) zip_time = zip_time + time.time() index.filelist.append(file_index) print "\tCreating indexes for %i caches" % total_caches index_xml_time = time.time() print "\tCreating XML Index"
print "Warning:packing multiple small files(<100KiB)" print "\tThese should be combined" if( sz > 5*1024*1024 ): print "Warning:large file(>5Mib):",basefile print "\tGPX size:",sz print "\tThis should be split into smaller files" parse_time = time.time() print "\tParsing XML into cachelist" p = GpxParser() f = open( file, "rb" ) text = f.read() f.close() file_index.cachelist = p.ParseText(text) file_index.crc = crc32(text) file_index.name = os.path.basename(file) print "\tFound %i caches" % ( len(file_index.cachelist) ) total_caches = total_caches + len(file_index.cachelist) parse_time = time.time() - parse_time print "\tZipping" zip_time = zip_time - time.time() z.write(file,"data/" + basefile ) zip_time = zip_time + time.time() index.filelist.append( file_index ) print "\tCreating indexes for %i caches" % total_caches index_xml_time = time.time() print "\tCreating XML Index"