@@ -2928,6 +2928,7 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
29282928 outlist ['ffilelist' ].append (HeaderOut )
29292929 countnum = countnum + 1
29302930 realidnum = realidnum + 1
2931+ outlist .update ({'fp' : fp })
29312932 return outlist
29322933
29332934
@@ -3281,6 +3282,33 @@ def ReadInMultipleFilesWithContentToArray(infile, fmttype="auto", filestart=0, s
32813282 return ReadInMultipleFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
32823283
32833284
3285+ def ReadInStackedFileWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3286+ outretval = []
3287+ outstartfile = filestart
3288+ while True :
3289+ outarray = ReadInFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3290+ if outarray is False : # stop when function signals False
3291+ break
3292+ infile = outarray ['fp' ]
3293+ print (infile .tell ())
3294+ outretval .append (outarray )
3295+ return outretval
3296+
3297+
3298+ def ReadInMultipleStackedFileWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3299+ if (isinstance (infile , (list , tuple , ))):
3300+ pass
3301+ else :
3302+ infile = [infile ]
3303+ outretval = {}
3304+ for curfname in infile :
3305+ curretfile [curfname ] = ReadInStackedFileWithContentToArray (curfname , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3306+ return outretval
3307+
3308+ def ReadInMultipleStackedFilesWithContentToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
3309+ return ReadInMultipleStackedFileWithContentToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend )
3310+
3311+
32843312def ReadInFileWithContentToList (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False ):
32853313 if (IsNestedDict (formatspecs ) and fmttype != "auto" and fmttype in formatspecs ):
32863314 formatspecs = formatspecs [fmttype ]
@@ -4031,12 +4059,6 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, filevalues=[], ext
40314059 fcsize , fuid , funame , fgid , fgname , fcurfid , fcurinode , flinkcount , fdev , fdev_minor , fdev_major , "+" + str (len (formatspecs ['format_delimiter' ]))]
40324060 AppendFileHeaderWithContent (
40334061 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
4034- if (numfiles > 0 ):
4035- try :
4036- fp .write (AppendNullBytes (
4037- ["0" , "0" ], formatspecs ['format_delimiter' ]))
4038- except OSError :
4039- return False
40404062 fp .seek (0 , 0 )
40414063 return fp
40424064
@@ -4100,12 +4122,6 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, filevalues=[], extr
41004122 fcontents .seek (0 , 0 )
41014123 AppendFileHeaderWithContent (
41024124 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
4103- if (numfiles > 0 ):
4104- try :
4105- fp .write (AppendNullBytes (
4106- ["0" , "0" ], formatspecs ['format_delimiter' ]))
4107- except OSError :
4108- return False
41094125 return fp
41104126
41114127
@@ -5498,12 +5514,6 @@ def PackArchiveFile(infiles, outfile, dirlistfromtxt=False, fmttype="auto", comp
54985514 AppendFileHeaderWithContent (
54995515 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
55005516 fcontents .close ()
5501- if (numfiles > 0 ):
5502- try :
5503- fp .write (AppendNullBytes (
5504- ["0" , "0" ], formatspecs ['format_delimiter' ]))
5505- except OSError :
5506- return False
55075517 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
55085518 fp = CompressOpenFileAlt (
55095519 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -5799,12 +5809,6 @@ def PackArchiveFileFromTarFile(infile, outfile, fmttype="auto", compression="aut
57995809 AppendFileHeaderWithContent (
58005810 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
58015811 fcontents .close ()
5802- if (numfiles > 0 ):
5803- try :
5804- fp .write (AppendNullBytes (
5805- ["0" , "0" ], formatspecs ['format_delimiter' ]))
5806- except OSError :
5807- return False
58085812 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
58095813 fp = CompressOpenFileAlt (
58105814 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6093,12 +6097,6 @@ def PackArchiveFileFromZipFile(infile, outfile, fmttype="auto", compression="aut
60936097 AppendFileHeaderWithContent (
60946098 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
60956099 fcontents .close ()
6096- if (numfiles > 0 ):
6097- try :
6098- fp .write (AppendNullBytes (
6099- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6100- except OSError :
6101- return False
61026100 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
61036101 fp = CompressOpenFileAlt (
61046102 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6413,12 +6411,6 @@ def PackArchiveFileFromRarFile(infile, outfile, fmttype="auto", compression="aut
64136411 AppendFileHeaderWithContent (
64146412 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
64156413 fcontents .close ()
6416- if (numfiles > 0 ):
6417- try :
6418- fp .write (AppendNullBytes (
6419- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6420- except OSError :
6421- return False
64226414 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
64236415 fp = CompressOpenFileAlt (
64246416 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -6667,12 +6659,6 @@ def PackArchiveFileFromSevenZipFile(infile, outfile, fmttype="auto", compression
66676659 AppendFileHeaderWithContent (
66686660 fp , tmpoutlist , extradata , jsondata , fcontents .read (), [checksumtype [1 ], checksumtype [2 ], checksumtype [3 ]], formatspecs )
66696661 fcontents .close ()
6670- if (numfiles > 0 ):
6671- try :
6672- fp .write (AppendNullBytes (
6673- ["0" , "0" ], formatspecs ['format_delimiter' ]))
6674- except OSError :
6675- return False
66766662 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
66776663 fp = CompressOpenFileAlt (
66786664 fp , compression , compressionlevel , compressionuselist , formatspecs )
@@ -7556,6 +7542,33 @@ def MultipleArchiveFilesToArray(infile, fmttype="auto", filestart=0, seekstart=0
75567542 return MultipleArchiveFileToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
75577543
75587544
7545+ def StackedArchiveFileToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7546+ outretval = []
7547+ outstartfile = filestart
7548+ while True :
7549+ outarray = ArchiveFileToArray (infile , fmttype , outstartfile , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , True )
7550+ if outarray is False : # stop when function signals False
7551+ break
7552+ infile = outarray ['fp' ]
7553+ print (infile .tell ())
7554+ outretval .append (outarray )
7555+ return outretval
7556+
7557+
7558+ def MultipleStackedArchiveFileToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7559+ if (isinstance (infile , (list , tuple , ))):
7560+ pass
7561+ else :
7562+ infile = [infile ]
7563+ outretval = {}
7564+ for curfname in infile :
7565+ curretfile [curfname ] = StackedArchiveFileToArray (curfname , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
7566+ return outretval
7567+
7568+ def MultipleStackedArchiveFilesToArray (infile , fmttype = "auto" , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , uncompress = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
7569+ return MultipleStackedArchiveFileToArray (infile , fmttype , filestart , seekstart , seekend , listonly , contentasfile , uncompress , skipchecksum , formatspecs , seektoend , returnfp )
7570+
7571+
75597572def ArchiveFileStringToArray (instr , filestart = 0 , seekstart = 0 , seekend = 0 , listonly = False , contentasfile = True , skipchecksum = False , formatspecs = __file_format_multi_dict__ , seektoend = False , returnfp = False ):
75607573 checkcompressfile = CheckCompressionSubType (infile , formatspecs , filestart , True )
75617574 if (IsNestedDict (formatspecs ) and checkcompressfile in formatspecs ):
@@ -7948,12 +7961,6 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
79487961 fcontents .close ()
79497962 lcfi = lcfi + 1
79507963 reallcfi = reallcfi + 1
7951- if (lcfx > 0 ):
7952- try :
7953- fp .write (AppendNullBytes (
7954- ["0" , "0" ], formatspecs ['format_delimiter' ]))
7955- except OSError :
7956- return False
79577964 if (outfile == "-" or outfile is None or hasattr (outfile , "read" ) or hasattr (outfile , "write" )):
79587965 fp = CompressOpenFileAlt (
79597966 fp , compression , compressionlevel , compressionuselist , formatspecs )
0 commit comments