From e924950634406c4ab3369f20d9593a69b2b45af6 Mon Sep 17 00:00:00 2001 From: 4am Date: Thu, 24 May 2018 15:59:23 -0400 Subject: [PATCH] cut chunk before address prologue to reasonable size so converted tracks aren't too large --- passport.py | 2 +- passport/__init__.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/passport.py b/passport.py index 4157341..be982f8 100755 --- a/passport.py +++ b/passport.py @@ -37,6 +37,6 @@ else: print("unrecognized file type") usage(1) -logger = DebugLogger # TODO add flag to change this +logger = DefaultLogger # TODO add flag to change this processor(reader(inputfile), logger) diff --git a/passport/__init__.py b/passport/__init__.py index efc951c..a414b56 100755 --- a/passport/__init__.py +++ b/passport/__init__.py @@ -218,16 +218,14 @@ class RWTS: # if we can't even find a single address prologue, just give up self.logger.debug("can't find a single address prologue so LGTM or whatever") break + if track.bit_index - start_bit_index > 256: + start_bit_index = track.bit_index - 256 # decode address field address_field = self.address_field_at_point(track) - self.logger.debug(repr(address_field.sector_num)) if address_field.sector_num in verified_sectors: # the sector we just found is a sector we've already decoded - # properly, so skip past it + # properly, so skip it self.logger.debug("duplicate sector %d" % address_field.sector_num) - if self.find_data_prologue(track): - if self.data_field_at_point(track): - self.verify_data_epilogue_at_point(track) continue if address_field.sector_num > self.sectors_per_track: # found a weird sector whose ID is out of range @@ -276,6 +274,7 @@ class RWTS: # all good, and we want to save this sector, so do it sectors[address_field.sector_num] = Sector(address_field, decoded, start_bit_index, end_bit_index) verified_sectors.append(address_field.sector_num) + self.logger.debug("saved sector %s" % hex(address_field.sector_num)) # remove placeholders of sectors that we found but couldn't decode properly # (made slightly more difficult by the fact that we're trying to remove # elements from an OrderedDict while iterating through the OrderedDict,