diff --git a/tclcheck_allfull.py b/tclcheck_allfull.py index d51898f..a6b2a93 100644 --- a/tclcheck_allfull.py +++ b/tclcheck_allfull.py @@ -45,6 +45,8 @@ for prd, variant in prds.items(): tcllib.ANSI_CYAN_DARK + variant["last_full"] + tcllib.ANSI_RESET, variant["last_ota"] ) + else: + fc.delete_last_dump() print("{}: {} {} ({})".format(prd, txt_tv, fhash, model)) except RequestException as e: print("{}: {}".format(prd, str(e))) diff --git a/tcllib.py b/tcllib.py index a0039ba..ab1cd5e 100644 --- a/tcllib.py +++ b/tcllib.py @@ -94,6 +94,7 @@ class FotaCheck: self.master_servers_weights = [3] * len(self.master_servers) self.check_time_sum = 3 self.check_time_count = 1 + self.last_dump_filename = None self.reset_session() def reset_session(self): @@ -153,6 +154,12 @@ class FotaCheck: raise with open(outfile, "w", encoding="utf-8") as f: f.write(data) + self.last_dump_filename = outfile + + def delete_last_dump(self): + if self.last_dump_filename: + os.unlink(self.last_dump_filename) + self.last_dump_filename = None @staticmethod def write_info_if_dumps_found():