I am invoking lftp command through a python subprocess and in the lftp command using -n flag of pget to set the max connections. Now when the download is in progress, a status file by the name filename.lftp-pget-status gets created and it automatically gets removed once the download is over.
Here is a sample output of the status file for connections = 4
$ cat abc_20200619.gz.lftp-pget-status
size=1837873446
0.pos=459472896
0.limit=459468363
1.pos=1301863572
1.limit=1378405085
2.pos=1735117533
2.limit=1837873446
I need to track the progress of the download from the status file. I am having trouble in understanding the contents, since the partitions also gets reduced at the end of download. I wrote the below formula to calculate the bytes of data downloaded, but i don't think that is the correct way.
bytes_downloaded = 0.pos + (1.pos-0.limit) + (2.pos-1.limit) + (n.pos-(n-1).limit)
Anyone have any idea of tracking lftp downloads from the status file ?