@@ -2321,7 +2321,7 @@ def ReadFileHeaderDataWithContentToArray(fp, listonly=False, contentasfile=True,
23212321 if (not contentasfile ):
23222322 fcontents = fcontents .read ()
23232323 outlist = {'fheadersize' : fheadsize , 'fhstart' : fheaderstart , 'fhend' : fhend , 'ftype' : ftype , 'fencoding' : fencoding , 'fcencoding' : fcencoding , 'fname' : fname , 'fbasedir' : fbasedir , 'flinkname' : flinkname , 'fsize' : fsize , 'fatime' : fatime , 'fmtime' : fmtime , 'fctime' : fctime , 'fbtime' : fbtime , 'fmode' : fmode , 'fchmode' : fchmode , 'ftypemod' : ftypemod , 'fwinattributes' : fwinattributes , 'fcompression' : fcompression , 'fcsize' : fcsize , 'fuid' : fuid , 'funame' : funame , 'fgid' : fgid , 'fgname' : fgname , 'finode' : finode , 'flinkcount' : flinkcount ,
2324- 'fdev' : fdev , 'fminor' : fdev_minor , 'fmajor' : fdev_major , 'fseeknextfile' : fseeknextfile , 'fheaderchecksumtype' : HeaderOut [- 4 ], 'fcontentchecksumtype' : HeaderOut [- 3 ], 'fnumfields' : fnumfields + 2 , 'frawheader' : HeaderOut , 'fextrafields' : fextrafields , 'fextrafieldsize' : fextrasize , 'fextralist ' : fextrafieldslist , 'jsondata ' : fjsoncontent , 'fheaderchecksum' : fcs , 'fcontentchecksum' : fccs , 'fhascontents' : pyhascontents , 'fcontentstart' : fcontentstart , 'fcontentend' : fcontentend , 'fcontentasfile' : contentasfile , 'fcontents' : fcontents }
2324+ 'fdev' : fdev , 'fminor' : fdev_minor , 'fmajor' : fdev_major , 'fseeknextfile' : fseeknextfile , 'fheaderchecksumtype' : HeaderOut [- 4 ], 'fcontentchecksumtype' : HeaderOut [- 3 ], 'fnumfields' : fnumfields + 2 , 'frawheader' : HeaderOut , 'fextrafields' : fextrafields , 'fextrafieldsize' : fextrasize , 'fextradata ' : fextrafieldslist , 'fjsondata ' : fjsoncontent , 'fheaderchecksum' : fcs , 'fcontentchecksum' : fccs , 'fhascontents' : pyhascontents , 'fcontentstart' : fcontentstart , 'fcontentend' : fcontentend , 'fcontentasfile' : contentasfile , 'fcontents' : fcontents }
23252325 return outlist
23262326
23272327
@@ -2597,7 +2597,7 @@ def ReadFileDataWithContentToArray(fp, seekstart=0, seekend=0, listonly=False, c
25972597 return False
25982598 formversions = re .search ('(.*?)(\\ d+)' , formstring ).groups ()
25992599 fcompresstype = ""
2600- outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextralist ' : fextrafieldslist , 'ffilelist' : []}
2600+ outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextradata ' : fextrafieldslist , 'ffilelist' : []}
26012601 if (seekstart < 0 and seekstart > fnumfiles ):
26022602 seekstart = 0
26032603 if (seekend == 0 or seekend > fnumfiles and seekend < seekstart ):
@@ -3832,12 +3832,12 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
38323832 return fp
38333833
38343834
3835- def AppendInFileWithContent (infile , fp , dirlistfromtxt = False , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False ):
3835+ def AppendInFileWithContent (infile , fp , dirlistfromtxt = False , filevalues = [], extradata = [], jsondata = {}, followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False ):
38363836 inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , False , True , False , formatspecs )
3837- return AppendListsWithContent (inlist , fp , dirlistfromtxt , filevalues , extradata , followlink , checksumtype , formatspecs , verbose )
3837+ return AppendListsWithContent (inlist , fp , dirlistfromtxt , filevalues , extradata , jsondata , followlink , checksumtype , formatspecs , verbose )
38383838
38393839
3840- def AppendFilesWithContentToOutFile (infiles , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_multi_dict__ , verbose = False , returnfp = False ):
3840+ def AppendFilesWithContentToOutFile (infiles , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , compressionuselist = compressionlistalt , filevalues = [], extradata = [], jsondata = {}, followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_multi_dict__ , verbose = False , returnfp = False ):
38413841 if (IsNestedDict (formatspecs ) and fmttype == "auto" and
38423842 (outfile != "-" and outfile is not None and not hasattr (outfile , "read" ) and not hasattr (outfile , "write" ))):
38433843 get_in_ext = os .path .splitext (outfile )
@@ -3878,7 +3878,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
38783878 fp = CompressOpenFile (outfile , compresswholefile , compressionlevel )
38793879 except PermissionError :
38803880 return False
3881- AppendFilesWithContent (infiles , fp , dirlistfromtxt , filevalues , extradata , compression ,
3881+ AppendFilesWithContent (infiles , fp , dirlistfromtxt , filevalues , extradata , jsondata , compression ,
38823882 compresswholefile , compressionlevel , compressionuselist , followlink , checksumtype , formatspecs , verbose )
38833883 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
38843884 fp = CompressCatFile (
@@ -3917,7 +3917,7 @@ def AppendFilesWithContentToOutFile(infiles, outfile, dirlistfromtxt=False, fmtt
39173917 return True
39183918
39193919
3920- def AppendListsWithContentToOutFile (inlist , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
3920+ def AppendListsWithContentToOutFile (inlist , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , filevalues = [], extradata = [], jsondata = {}, followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
39213921 if (IsNestedDict (formatspecs ) and fmttype == "auto" and
39223922 (outfile != "-" and outfile is not None and not hasattr (outfile , "read" ) and not hasattr (outfile , "write" ))):
39233923 get_in_ext = os .path .splitext (outfile )
@@ -3958,7 +3958,7 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
39583958 fp = CompressOpenFile (outfile , compresswholefile , compressionlevel )
39593959 except PermissionError :
39603960 return False
3961- AppendListsWithContent (inlist , fp , dirlistfromtxt , filevalues , extradata , compression ,
3961+ AppendListsWithContent (inlist , fp , dirlistfromtxt , filevalues , extradata , jsondata , compression ,
39623962 compresswholefile , compressionlevel , followlink , checksumtype , formatspecs , verbose )
39633963 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
39643964 fp = CompressCatFile (
@@ -3997,9 +3997,9 @@ def AppendListsWithContentToOutFile(inlist, outfile, dirlistfromtxt=False, fmtty
39973997 return True
39983998
39993999
4000- def AppendInFileWithContentToOutFile (infile , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , filevalues = [], extradata = [], followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
4000+ def AppendInFileWithContentToOutFile (infile , outfile , dirlistfromtxt = False , fmttype = "auto" , compression = "auto" , compresswholefile = True , compressionlevel = None , filevalues = [], extradata = [], jsondata = {}, followlink = False , checksumtype = ["crc32" , "crc32" , "crc32" ], formatspecs = __file_format_dict__ , verbose = False , returnfp = False ):
40014001 inlist = ReadInFileWithContentToList (infile , "auto" , 0 , 0 , False , False , True , False , formatspecs )
4002- return AppendListsWithContentToOutFile (inlist , outfile , dirlistfromtxt , fmttype , compression , compresswholefile , compressionlevel , filevalues , extradata , followlink , checksumtype , formatspecs , verbose , returnfp )
4002+ return AppendListsWithContentToOutFile (inlist , outfile , dirlistfromtxt , fmttype , compression , compresswholefile , compressionlevel , filevalues , extradata , jsondata , followlink , checksumtype , formatspecs , verbose , returnfp )
40034003
40044004
40054005def PrintPermissionString (fchmode , ftype ):
@@ -6622,7 +6622,7 @@ def CatFileSeekToFileNum(infile, fmttype="auto", seekto=0, listonly=False, conte
66226622 fcompresstype = compresscheck
66236623 if (fcompresstype == formatspecs ['format_magic' ]):
66246624 fcompresstype = ""
6625- outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextralist ' : fextrafieldslist , 'ffilelist' : []}
6625+ outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextradata ' : fextrafieldslist , 'ffilelist' : []}
66266626 if (seekto >= fnumfiles ):
66276627 seekto = fnumfiles - 1
66286628 if (seekto < 0 ):
@@ -6922,7 +6922,7 @@ def CatFileSeekToFileName(infile, fmttype="auto", seekfile=None, listonly=False,
69226922 fcompresstype = compresscheck
69236923 if (fcompresstype == formatspecs ['format_magic' ]):
69246924 fcompresstype = ""
6925- outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextralist ' : fextrafieldslist , 'ffilelist' : []}
6925+ outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextradata ' : fextrafieldslist , 'ffilelist' : []}
69266926 seekto = fnumfiles - 1
69276927 filefound = False
69286928 if (seekto >= 0 ):
@@ -7581,7 +7581,7 @@ def CatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
75817581 fcompresstype = compresscheck
75827582 if (fcompresstype == formatspecs ['format_magic' ]):
75837583 fcompresstype = ""
7584- outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextralist ' : fextrafieldslist , 'ffilelist' : []}
7584+ outlist = {'fnumfiles' : fnumfiles , 'fformat' : formversions [0 ], 'fcompression' : fcompresstype , 'fencoding' : fhencoding , 'fversion' : formversions [1 ], 'fostype' : fostype , 'fheadersize' : fheadsize , 'fsize' : CatSizeEnd , 'fnumfields' : fnumfields + 2 , 'fformatspecs' : formatspecs , 'fchecksumtype' : fprechecksumtype , 'fheaderchecksum' : fprechecksum , 'frawheader' : [formstring ] + inheader , 'fextrafields' : fnumextrafields , 'fextrafieldsize' : fnumextrafieldsize , 'fextradata ' : fextrafieldslist , 'ffilelist' : []}
75857585 if (seekstart < 0 and seekstart > fnumfiles ):
75867586 seekstart = 0
75877587 if (seekend == 0 or seekend > fnumfiles and seekend < seekstart ):
@@ -7817,7 +7817,7 @@ def CatFileToArray(infile, fmttype="auto", seekstart=0, seekend=0, listonly=Fals
78177817 outfcontents .seek (0 , 0 )
78187818 if (not contentasfile ):
78197819 outfcontents = outfcontents .read ()
7820- outlist ['ffilelist' ].append ({'fid' : realidnum , 'fidalt' : fileidnum , 'fheadersize' : outfheadsize , 'fhstart' : outfhstart , 'fhend' : outfhend , 'ftype' : outftype , 'fencoding' : outfencoding , 'fcencoding' : outfcencoding , 'fname' : outfname , 'fbasedir' : outfbasedir , 'flinkname' : outflinkname , 'fsize' : outfsize , 'fatime' : outfatime , 'fmtime' : outfmtime , 'fctime' : outfctime , 'fbtime' : outfbtime , 'fmode' : outfmode , 'fchmode' : outfchmode , 'ftypemod' : outftypemod , 'fwinattributes' : outfwinattributes , 'fcompression' : outfcompression , 'fcsize' : outfcsize , 'fuid' : outfuid , 'funame' : outfuname , 'fgid' : outfgid , 'fgname' : outfgname , 'finode' : outfinode , 'flinkcount' : outflinkcount , 'fdev' : outfdev , 'fminor' : outfdev_minor , 'fmajor' : outfdev_major , 'fseeknextfile' : outfseeknextfile , 'fheaderchecksumtype' : inheaderdata [- 4 ], 'fcontentchecksumtype' : inheaderdata [- 3 ], 'fnumfields' : outfnumfields + 2 , 'frawheader' : inheaderdata , 'fextrafields' : outfextrafields , 'fextrafieldsize' : outfextrasize , 'fextralist' : extrafieldslist , 'jsondata' : outfjsoncontent , 'fheaderchecksum' : outfcs , 'fcontentchecksum' : outfccs , 'fhascontents' : pyhascontents , 'fcontentstart' : outfcontentstart , 'fcontentend' : outfcontentend , 'fcontentasfile' : contentasfile , 'fcontents' : outfcontents })
7820+ outlist ['ffilelist' ].append ({'fid' : realidnum , 'fidalt' : fileidnum , 'fheadersize' : outfheadsize , 'fhstart' : outfhstart , 'fhend' : outfhend , 'ftype' : outftype , 'fencoding' : outfencoding , 'fcencoding' : outfcencoding , 'fname' : outfname , 'fbasedir' : outfbasedir , 'flinkname' : outflinkname , 'fsize' : outfsize , 'fatime' : outfatime , 'fmtime' : outfmtime , 'fctime' : outfctime , 'fbtime' : outfbtime , 'fmode' : outfmode , 'fchmode' : outfchmode , 'ftypemod' : outftypemod , 'fwinattributes' : outfwinattributes , 'fcompression' : outfcompression , 'fcsize' : outfcsize , 'fuid' : outfuid , 'funame' : outfuname , 'fgid' : outfgid , 'fgname' : outfgname , 'finode' : outfinode , 'flinkcount' : outflinkcount , 'fdev' : outfdev , 'fminor' : outfdev_minor , 'fmajor' : outfdev_major , 'fseeknextfile' : outfseeknextfile , 'fheaderchecksumtype' : inheaderdata [- 4 ], 'fcontentchecksumtype' : inheaderdata [- 3 ], 'fnumfields' : outfnumfields + 2 , 'frawheader' : inheaderdata , 'fextrafields' : outfextrafields , 'fextrafieldsize' : outfextrasize , 'fextradata' : extrafieldslist , 'fjsondata' : outfjsoncontent , 'fheaderchecksum' : outfcs , 'fcontentchecksum' : outfccs , 'fhascontents' : pyhascontents , 'fcontentstart' : outfcontentstart , 'fcontentend' : outfcontentend , 'fcontentasfile' : contentasfile , 'fcontents' : outfcontents })
78217821 fileidnum = fileidnum + 1
78227822 realidnum = realidnum + 1
78237823 if (returnfp ):
0 commit comments