total_caches = 0 if( len( sys.argv ) >= 2 ): gpxindex = Index() for file in sys.argv[1:]: small_files = 0 print "Checking:",file z = zipfile.ZipFile(file, "r") #Build up a reference-index for filename in z.namelist(): if( filename.startswith("data/") and filename.endswith(".gpx") ): p = GpxParser() text = z.read(filename) file_index = FileIndex() file_index.cachelist = p.ParseText(text) info = z.getinfo(filename) file_index.crc = crc32(text) if( file_index.crc < 0 ): #crc32, depending on py version will either return #signed 32 bit or unsigned 32 bit, so we adjust if needed file_index.crc = long(file_index.crc) 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
from index import Index, FileIndex from gpx_parse import GpxParser from index_to_xml import index_to_xml total_caches = 0 if (len(sys.argv) >= 3): os.system("rm -f %s" % sys.argv[-1]) z = zipfile.ZipFile(sys.argv[-1], "w", zipfile.ZIP_DEFLATED) small_files = 0 # Create tables index = Index() for file in sys.argv[1:-1]: file_index = FileIndex() zip_time = 0 basefile = os.path.basename(file) print "Processing %s" % (basefile) sz = os.path.getsize(file) if (sz < 100 * 1024): small_files = small_files + 1 if (small_files == 2): 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"
from index import Index,FileIndex from gpx_parse import GpxParser from index_to_xml import index_to_xml total_caches = 0 if( len( sys.argv ) >= 3 ): os.system("rm -f %s"%sys.argv[-1]) z = zipfile.ZipFile( sys.argv[-1], "w", zipfile.ZIP_DEFLATED ) small_files = 0 # Create tables index = Index() for file in sys.argv[ 1:-1]: file_index = FileIndex() zip_time = 0 basefile = os.path.basename(file) print "Processing %s"%(basefile) sz = os.path.getsize(file) if( sz < 100*1024 ): small_files = small_files + 1 if( small_files == 2 ): 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"