On Retry the number of downloaded bytes could exceed the total bytes

This commit is contained in:
Safihre committed 2021-12-30 09:40:40 +01:00
1 parent 406c4d20cf
commit a72401a529
2 files changed
+11 -18

No files matched your search

+10 -12
View File
@@ -1265,14 +1265,9 @@ class NzbObject(TryList):
existing_files.remove(existing_filename)
# Set bytes correctly
nzf.bytes_left = 0
self.bytes_tried += nzf.bytes
self.bytes_downloaded += nzf.bytes
# Process par2 files
filepath = os.path.join(wdir, existing_filename)
if sabnzbd.par2file.is_parfile(filepath):
self.handle_par2(nzf, filepath)
self.bytes_par2 += nzf.bytes
break
# Create an NZF for each remaining existing file
@@ -1290,19 +1285,22 @@ class NzbObject(TryList):
self.remove_nzf(nzf)
# Set bytes correctly
nzf.bytes_left = 0
self.bytes += nzf.bytes
self.bytes_tried += nzf.bytes
self.bytes_downloaded += nzf.bytes
# Process par2 files
if sabnzbd.par2file.is_parfile(filepath):
self.handle_par2(nzf, filepath)
self.bytes_par2 += nzf.bytes
except:
logging.error(T("Error importing %s"), self.final_name)
logging.info("Traceback: ", exc_info=True)
# Process all the par2 files in one go, because handle_par2
# otherwise updates the byte-counters incorrectly.
for nzf in self.finished_files:
filepath = os.path.join(wdir, nzf.filename)
if sabnzbd.par2file.is_parfile(filepath):
self.handle_par2(nzf, filepath)
self.bytes_par2 += nzf.bytes
@property
def pp(self):
if self.repair is None:
+1 -6
View File
@@ -124,13 +124,8 @@ def parse_par2_file(fname: str, md5of16k: Dict[bytes, str]) -> Dict[str, bytes]:
break
header = f.read(8)
except (struct.error, IndexError):
logging.info('Cannot use corrupt par2 file for QuickCheck, "%s"', fname)
logging.debug("Traceback: ", exc_info=True)
table = {}
except:
logging.info("QuickCheck parser crashed in file %s", fname)
logging.info("Par2 parser crashed in file %s", fname)
logging.debug("Traceback: ", exc_info=True)
table = {}