diff --git a/edosl0util/stream.py b/edosl0util/stream.py index 6b26b2006bd2326f2b4a0fcd13cb124da6dfcc70..757a9d3861aa267c224b89c6958aff4e3a2ef43f 100644 --- a/edosl0util/stream.py +++ b/edosl0util/stream.py @@ -211,6 +211,7 @@ class PacketStream(object): if len(self._seek_cache): return self._seek_cache.popleft() try: + # namedtuple('Tracker', ['h1', 'h2', 'size', 'offset', 'data']) h1, h2, data_size, offset, data = self._stream.next() except PacketTooShort as err: if self._fail_on_tooshort: diff --git a/scripts/prune_packets.py b/scripts/prune_packets.py index 4d110db3c154f394ade9496209824abc4e45db0c..b2427669f0fe2e4cac7b74944c9476cc02059c2e 100755 --- a/scripts/prune_packets.py +++ b/scripts/prune_packets.py @@ -14,25 +14,19 @@ parser.add_argument('outfile') args = parser.parse_args() - -def pack_hdr_bytes(hdr): - return c.string_at(c.byref(hdr), c.sizeof(hdr)) - - with open(args.outfile, 'wb') as fptr: idx = 0 - for pkt in stream.PacketStream(open(args.pdsfile)): + for pkt in stream.jpss_packet_stream(open(args.pdsfile)): h1 = pkt.primary_header h2 = pkt.secondary_header if h2: - h1.data_length_minus1 = c.sizeof(h2) - 1 + h1.data_length_minus1 = c.sizeof(h2) fptr.write(h1) - if pkt.stamp: - h2.packet_count = 0 fptr.write(h2) + fptr.write('\xff') else: h1.data_length_minus1 = 0 fptr.write(h1) - fptr.write('x') + fptr.write('\xff') idx += 1