Commit d5901897 authored by Andrey Filippov's avatar Andrey Filippov

correctly processing split files, modified filenames for sorting

parent b46a9a1d
This diff is collapsed.
......@@ -147,7 +147,7 @@ for i in range(len(cams)):
if args.n==0:
data_size_blocks = pc.read_camogm_disk_file_blocks("/dev/"+p[1][0:-1]+"1", args.file_end)
data_skip_blocks = pc.read_camogm_disk_file_blocks("/dev/"+p[1][0:-1]+"1", args.file_start)
data_size_blocks -= data_skip_blocks
data_size_blocks -= data_skip_blocks # before it included skipped !
else:
data_size_blocks = args.n
data_skip_blocks = args.skip
......
......@@ -260,7 +260,8 @@ class PC():
if not os.path.isdir(dirname):
os.mkdir(dirname)
for i in range(0,dl_n+dl_skip):
fname = dirname+"/"+"file_"+str(i)+".img"
# fname = dirname+"/"+"file_"+str(i)+".img"
fname = "%s/file_%03d.img" %(dirname, i) #dirname+"/"+"file_"+str(i)+".img"
skip = i*(dl_bc-1)
if i>=dl_skip:
shout("sudo dd if="+part+" "+" of="+fname+" bs="+str(dl_bs)+"M count="+str(dl_bc)+" skip="+str(skip))
......@@ -280,12 +281,12 @@ class PC():
os.mkdir(dirname)
num_file = 0
# optional first file to align skip to chunk_blocks, 1 block at a time
if (blocks_skip > 0) and ((blocks_skip // chunk_blocks) > 0):
bwrite = chunk_blocks - (blocks_skip // chunk_blocks)
if (blocks_skip > 0) and ((blocks_skip % chunk_blocks) > 0):
bwrite = chunk_blocks - (blocks_skip % chunk_blocks)
if (bwrite > blocks_load):
bwrite = blocks_load
fname = dirname+"/"+"file_"+str(num_file)+".img"
print("Aligning skip to chunks, writing %d %d-byte blocks (skipping %d blocks) to %s"%(bwrite, block_size, blocks_skip, fname))
print("Aligning skip to chunks, downloading %d %d-byte blocks (skipping %d blocks) to %s"%(bwrite, block_size, blocks_skip, fname))
shout("sudo dd if="+part+" "+" of="+fname+" bs="+str(block_size)+" count="+str(bwrite)+" skip="+str(blocks_skip))
blocks_skip += bwrite
blocks_load -= bwrite
......@@ -297,7 +298,7 @@ class PC():
if (chunks_write > file_chunks):
chunks_write = file_chunks
fname = dirname+"/"+"file_"+str(num_file)+".img"
print("Writing %d %d-byte chunks, skipping %d chunks to %s"%(chunks_write, chunk_bytes, chunks_skip, fname))
print("Downloading %d %d-byte chunks, skipping %d chunks to %s"%(chunks_write, chunk_bytes, chunks_skip, fname))
shout("sudo dd if="+part+" "+" of="+fname+" bs="+str(chunk_bytes)+" count="+str(chunks_write)+" skip="+str(chunks_skip))
bwrite = chunks_write * chunk_blocks
blocks_skip += bwrite
......@@ -306,7 +307,7 @@ class PC():
# optionally write the remainder (< chunk), 1 block at a time
if (blocks_load > 0):
fname = dirname+"/"+"file_"+str(num_file)+".img"
print("Writing last %d %d-byte blocks, skipping %d blocks to %s"%(blocks_load, block_size, blocks_skip, fname))
print("Downloading last %d %d-byte blocks, skipping %d blocks to %s"%(blocks_load, block_size, blocks_skip, fname))
shout("sudo dd if="+part+" "+" of="+fname+" bs="+str(block_size)+" count="+str(blocks_load)+" skip="+str(blocks_skip))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment