2018-11-08 18:12:53 +00:00
|
|
|
import hashlib
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
import numpy as np
|
|
|
|
|
2017-05-07 20:28:15 +00:00
|
|
|
from .segments import SegmentData, DefaultSegment
|
|
|
|
from .kboot import KBootImage
|
2017-10-02 05:28:57 +00:00
|
|
|
from .ataridos import AtariDosDiskImage, BootDiskImage, AtariDosFile, XexContainerSegment, AtariDiskImage
|
2017-05-07 20:28:15 +00:00
|
|
|
from .spartados import SpartaDosDiskImage
|
2018-11-08 21:38:15 +00:00
|
|
|
from .cartridge import AtariCartImage, Atari8bitCartImage, Atari5200CartImage, get_known_carts, RomImage, Atari2600CartImage, Atari2600StarpathImage
|
2017-05-07 20:28:15 +00:00
|
|
|
from .mame import MameZipImage
|
|
|
|
from .dos33 import Dos33DiskImage, ProdosDiskImage, Dos33BinFile
|
2017-05-10 00:53:28 +00:00
|
|
|
from .standard_delivery import StandardDeliveryImage
|
2018-06-24 19:10:59 +00:00
|
|
|
from . import errors
|
2018-05-01 05:28:47 +00:00
|
|
|
from .magic import guess_detail_for_mime
|
2018-06-25 06:07:47 +00:00
|
|
|
from . import container
|
2018-06-25 00:21:47 +00:00
|
|
|
from .dcm import DCMContainer
|
2018-11-08 18:12:53 +00:00
|
|
|
from .signatures import sha1_signatures
|
2016-06-01 21:54:52 +00:00
|
|
|
|
2016-10-02 01:42:39 +00:00
|
|
|
import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
|
2018-06-25 00:20:32 +00:00
|
|
|
class SegmentParser:
|
2016-06-01 21:54:52 +00:00
|
|
|
menu_name = ""
|
|
|
|
image_type = None
|
2017-03-21 23:25:59 +00:00
|
|
|
container_segment = DefaultSegment
|
2017-03-23 17:06:37 +00:00
|
|
|
|
2016-06-02 23:59:59 +00:00
|
|
|
def __init__(self, segment_data, strict=False):
|
2016-06-01 21:54:52 +00:00
|
|
|
self.image = None
|
|
|
|
self.segments = []
|
2016-06-02 23:59:59 +00:00
|
|
|
self.strict = strict
|
2017-03-19 20:07:19 +00:00
|
|
|
self.segment_data = segment_data
|
|
|
|
self.parse()
|
2016-06-02 23:59:59 +00:00
|
|
|
|
2017-05-19 05:12:48 +00:00
|
|
|
def __str__(self):
|
|
|
|
lines = []
|
|
|
|
lines.append("%s (%s)" % (self.menu_name, self.__class__.__name__))
|
|
|
|
if log.isEnabledFor(logging.DEBUG):
|
|
|
|
lines.append("segments:")
|
|
|
|
for s in self.segments:
|
|
|
|
lines.append(" %s" % s)
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
2017-04-05 05:21:03 +00:00
|
|
|
def __getstate__(self):
|
|
|
|
"""Custom jsonpickle state save routine
|
|
|
|
|
|
|
|
This routine culls down the list of attributes that should be
|
|
|
|
serialized, and in some cases changes their format slightly so they
|
|
|
|
have a better mapping to json objects. For instance, json can't handle
|
|
|
|
dicts with integer keys, so dicts are turned into lists of lists.
|
|
|
|
Tuples are also turned into lists because tuples don't have a direct
|
|
|
|
representation in json, while lists have a compact representation in
|
|
|
|
json.
|
|
|
|
"""
|
|
|
|
state = dict()
|
|
|
|
for key in ['segments', 'strict']:
|
|
|
|
state[key] = getattr(self, key)
|
|
|
|
return state
|
|
|
|
|
|
|
|
def __setstate__(self, state):
|
|
|
|
"""Custom jsonpickle state restore routine
|
|
|
|
|
|
|
|
The use of jsonpickle to recreate objects doesn't go through __init__,
|
|
|
|
so there will be missing attributes when restoring old versions of the
|
|
|
|
json. Once a version gets out in the wild and additional attributes are
|
|
|
|
added to a segment, a default value should be applied here.
|
|
|
|
"""
|
|
|
|
self.__dict__.update(state)
|
|
|
|
|
2017-03-19 20:07:19 +00:00
|
|
|
def parse(self):
|
|
|
|
r = self.segment_data
|
2017-03-21 23:25:59 +00:00
|
|
|
self.segments.append(self.container_segment(r, 0, name=self.menu_name))
|
2016-06-01 21:54:52 +00:00
|
|
|
try:
|
2017-05-19 05:12:48 +00:00
|
|
|
log.debug("Trying %s" % self.image_type)
|
2018-11-08 18:12:53 +00:00
|
|
|
log.debug(self.image_type.__mro__)
|
2016-06-02 22:09:34 +00:00
|
|
|
self.image = self.get_image(r)
|
2016-06-02 23:59:59 +00:00
|
|
|
self.check_image()
|
2016-06-01 21:54:52 +00:00
|
|
|
self.image.parse_segments()
|
2018-06-24 19:10:59 +00:00
|
|
|
except errors.UnsupportedDiskImage:
|
2017-03-07 18:43:46 +00:00
|
|
|
raise
|
2018-06-24 19:10:59 +00:00
|
|
|
except errors.AtrError as e:
|
|
|
|
raise errors.InvalidSegmentParser(e)
|
2016-06-01 21:54:52 +00:00
|
|
|
self.segments.extend(self.image.segments)
|
|
|
|
|
2018-10-29 20:32:59 +00:00
|
|
|
def reconstruct_segments(self, new_rawdata):
|
|
|
|
self.image = self.get_image(new_rawdata)
|
|
|
|
self.segment_data = new_rawdata
|
|
|
|
for s in self.segments:
|
|
|
|
s.reconstruct_raw(new_rawdata)
|
|
|
|
|
2016-06-02 22:09:34 +00:00
|
|
|
def get_image(self, r):
|
2018-11-08 18:12:53 +00:00
|
|
|
log.info(f"checking image type {self.image_type}")
|
2016-06-02 22:09:34 +00:00
|
|
|
return self.image_type(r)
|
|
|
|
|
2016-06-02 23:59:59 +00:00
|
|
|
def check_image(self):
|
|
|
|
if self.strict:
|
|
|
|
try:
|
|
|
|
self.image.strict_check()
|
2018-06-24 19:10:59 +00:00
|
|
|
except errors.AtrError as e:
|
|
|
|
raise errors.InvalidSegmentParser(e)
|
2016-06-02 23:59:59 +00:00
|
|
|
else:
|
|
|
|
self.image.relaxed_check()
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
|
|
|
|
class DefaultSegmentParser(SegmentParser):
|
|
|
|
menu_name = "Raw Data"
|
2017-03-23 17:06:37 +00:00
|
|
|
|
2017-03-19 20:07:19 +00:00
|
|
|
def parse(self):
|
|
|
|
self.segments = [DefaultSegment(self.segment_data, 0)]
|
2016-06-01 21:54:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class KBootSegmentParser(SegmentParser):
|
|
|
|
menu_name = "KBoot Disk Image"
|
|
|
|
image_type = KBootImage
|
|
|
|
|
|
|
|
|
|
|
|
class AtariDosSegmentParser(SegmentParser):
|
|
|
|
menu_name = "Atari DOS Disk Image"
|
|
|
|
image_type = AtariDosDiskImage
|
|
|
|
|
|
|
|
|
|
|
|
class SpartaDosSegmentParser(SegmentParser):
|
|
|
|
menu_name = "Sparta DOS Disk Image"
|
|
|
|
image_type = SpartaDosDiskImage
|
|
|
|
|
|
|
|
|
|
|
|
class AtariBootDiskSegmentParser(SegmentParser):
|
|
|
|
menu_name = "Atari Boot Disk Image"
|
|
|
|
image_type = BootDiskImage
|
|
|
|
|
|
|
|
|
2017-10-02 05:28:57 +00:00
|
|
|
class AtariUnidentifiedSegmentParser(SegmentParser):
|
|
|
|
menu_name = "Atari Disk Image"
|
|
|
|
image_type = AtariDiskImage
|
|
|
|
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
class XexSegmentParser(SegmentParser):
|
|
|
|
menu_name = "XEX (Atari 8-bit executable)"
|
|
|
|
image_type = AtariDosFile
|
2017-03-21 23:25:59 +00:00
|
|
|
container_segment = XexContainerSegment
|
2016-06-01 21:54:52 +00:00
|
|
|
|
|
|
|
|
2016-06-02 22:09:34 +00:00
|
|
|
class AtariCartSegmentParser(SegmentParser):
|
|
|
|
menu_name = "temp"
|
|
|
|
image_type = AtariCartImage
|
2016-06-03 00:18:06 +00:00
|
|
|
cart_type = 0
|
2016-06-02 22:09:34 +00:00
|
|
|
cart_info = None
|
|
|
|
|
|
|
|
def get_image(self, r):
|
2018-11-08 18:12:53 +00:00
|
|
|
log.info(f"checking cart type {self.cart_type}: {self.image_type}")
|
2016-06-03 00:18:06 +00:00
|
|
|
return self.image_type(r, self.cart_type)
|
2016-06-02 22:09:34 +00:00
|
|
|
|
|
|
|
|
2018-11-08 18:12:53 +00:00
|
|
|
class Atari8bitCartParser(AtariCartSegmentParser):
|
2018-10-26 02:51:33 +00:00
|
|
|
menu_name = "Atari Home Computer Cartridge"
|
|
|
|
image_type = Atari8bitCartImage
|
|
|
|
|
|
|
|
|
2018-11-08 18:12:53 +00:00
|
|
|
class Atari5200CartParser(AtariCartSegmentParser):
|
2018-10-26 02:51:33 +00:00
|
|
|
menu_name = "Atari 5200 Cartridge"
|
|
|
|
image_type = Atari5200CartImage
|
|
|
|
|
|
|
|
|
2018-11-08 18:27:33 +00:00
|
|
|
class Atari2600CartParser(SegmentParser):
|
|
|
|
menu_name = "Atari 2600 Cartridge"
|
|
|
|
image_type = Atari2600CartImage
|
|
|
|
|
|
|
|
|
2018-11-08 21:38:15 +00:00
|
|
|
class Atari2600StarpathParser(SegmentParser):
|
|
|
|
menu_name = "Atari 2600 Starpath Cassette"
|
|
|
|
image_type = Atari2600StarpathImage
|
|
|
|
|
|
|
|
|
2018-10-26 02:51:33 +00:00
|
|
|
class RomParser(SegmentParser):
|
|
|
|
menu_name = "ROM Image"
|
|
|
|
image_type = RomImage
|
|
|
|
|
|
|
|
|
2016-06-03 19:40:48 +00:00
|
|
|
class MameZipParser(SegmentParser):
|
|
|
|
menu_name = "MAME ROM Zipfile"
|
|
|
|
image_type = MameZipImage
|
|
|
|
|
|
|
|
|
2016-07-20 15:13:44 +00:00
|
|
|
class Dos33SegmentParser(SegmentParser):
|
|
|
|
menu_name = "DOS 3.3 Disk Image"
|
|
|
|
image_type = Dos33DiskImage
|
|
|
|
|
|
|
|
|
2017-05-06 23:49:42 +00:00
|
|
|
class Dos33BinSegmentParser(SegmentParser):
|
|
|
|
menu_name = "BIN (Apple ][ executable)"
|
|
|
|
image_type = Dos33BinFile
|
|
|
|
|
|
|
|
|
2016-07-20 17:03:29 +00:00
|
|
|
class ProdosSegmentParser(SegmentParser):
|
|
|
|
menu_name = "ProDOS Disk Image"
|
|
|
|
image_type = ProdosDiskImage
|
|
|
|
|
|
|
|
|
2018-06-25 00:21:47 +00:00
|
|
|
known_containers = [
|
2018-06-25 06:07:47 +00:00
|
|
|
container.GZipContainer,
|
|
|
|
container.BZipContainer,
|
|
|
|
container.LZMAContainer,
|
2018-06-25 00:21:47 +00:00
|
|
|
DCMContainer,
|
|
|
|
]
|
|
|
|
|
|
|
|
|
2018-06-25 01:40:16 +00:00
|
|
|
def guess_container(r, verbose=False):
|
2018-06-25 00:21:47 +00:00
|
|
|
for c in known_containers:
|
2018-06-25 01:40:16 +00:00
|
|
|
if verbose:
|
|
|
|
log.info(f"trying container {c}")
|
2018-06-25 00:21:47 +00:00
|
|
|
try:
|
|
|
|
found = c(r)
|
2018-06-25 01:40:16 +00:00
|
|
|
except errors.InvalidContainer as e:
|
2018-06-25 00:21:47 +00:00
|
|
|
continue
|
|
|
|
else:
|
2018-06-25 01:40:16 +00:00
|
|
|
if verbose:
|
|
|
|
log.info(f"found container {c}")
|
2018-06-25 00:21:47 +00:00
|
|
|
return found
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
2018-11-08 18:12:53 +00:00
|
|
|
def guess_parser_by_size(r, verbose=False):
|
|
|
|
found = None
|
|
|
|
mime = None
|
|
|
|
size = len(r)
|
|
|
|
if size in sha1_signatures:
|
|
|
|
print(r)
|
2018-11-08 21:38:15 +00:00
|
|
|
sha_hash = hashlib.sha1(r.data).digest()
|
2018-11-08 18:12:53 +00:00
|
|
|
log.info(f"{size} in signature database, attempting to match {sha_hash}")
|
|
|
|
try:
|
|
|
|
match = sha1_signatures[size][sha_hash]
|
|
|
|
except KeyError:
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
mime = match[0]
|
|
|
|
log.info(f"found match: {match}")
|
|
|
|
parsers = mime_parsers[mime]
|
|
|
|
for parser in parsers:
|
|
|
|
try:
|
|
|
|
found = parser(r, False)
|
|
|
|
break
|
|
|
|
except errors.InvalidSegmentParser as e:
|
|
|
|
if verbose:
|
|
|
|
log.info("parser isn't %s: %s" % (parser.__name__, str(e)))
|
|
|
|
pass
|
|
|
|
if found is None:
|
|
|
|
log.info(f"no matching signature")
|
|
|
|
return mime, found
|
|
|
|
|
2016-10-02 01:42:39 +00:00
|
|
|
def guess_parser_for_mime(mime, r, verbose=False):
|
2016-06-01 21:54:52 +00:00
|
|
|
parsers = mime_parsers[mime]
|
|
|
|
found = None
|
|
|
|
for parser in parsers:
|
|
|
|
try:
|
2016-06-02 23:59:59 +00:00
|
|
|
found = parser(r, True)
|
2016-06-01 21:54:52 +00:00
|
|
|
break
|
2018-06-24 19:10:59 +00:00
|
|
|
except errors.InvalidSegmentParser as e:
|
2016-10-02 01:42:39 +00:00
|
|
|
if verbose:
|
|
|
|
log.info("parser isn't %s: %s" % (parser.__name__, str(e)))
|
2016-06-01 21:54:52 +00:00
|
|
|
pass
|
|
|
|
return found
|
|
|
|
|
2017-03-23 17:06:37 +00:00
|
|
|
|
2016-06-02 22:09:34 +00:00
|
|
|
def guess_parser_for_system(mime_base, r):
|
|
|
|
for mime in mime_parse_order:
|
|
|
|
if mime.startswith(mime_base):
|
|
|
|
p = guess_parser_for_mime(mime, r)
|
|
|
|
if p is not None:
|
2018-05-01 05:28:47 +00:00
|
|
|
mime = guess_detail_for_mime(mime, r, p)
|
2016-06-02 22:09:34 +00:00
|
|
|
return mime, p
|
|
|
|
return None, None
|
|
|
|
|
2017-03-23 17:06:37 +00:00
|
|
|
|
2016-06-03 19:40:48 +00:00
|
|
|
def iter_parsers(r):
|
2018-06-25 00:21:47 +00:00
|
|
|
container = guess_container(r.data)
|
|
|
|
if container is not None:
|
2018-06-25 06:07:47 +00:00
|
|
|
r = SegmentData(container.unpacked)
|
2018-11-08 18:12:53 +00:00
|
|
|
mime, parser = guess_parser_by_size(r)
|
|
|
|
if parser is None:
|
|
|
|
for mime in mime_parse_order:
|
|
|
|
p = guess_parser_for_mime(mime, r)
|
|
|
|
if p is not None:
|
|
|
|
parser = p
|
|
|
|
mime = guess_detail_for_mime(mime, r, p)
|
|
|
|
break
|
|
|
|
return mime, parser
|
2016-06-03 19:40:48 +00:00
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
|
2017-05-10 00:53:28 +00:00
|
|
|
def parsers_for_filename(name):
|
|
|
|
matches = []
|
|
|
|
for mime in mime_parse_order:
|
|
|
|
parsers = mime_parsers[mime]
|
|
|
|
found = None
|
|
|
|
for parser in parsers:
|
2017-07-07 19:20:47 +00:00
|
|
|
log.debug("parser: %s = %s" % (mime, parser))
|
2018-03-22 00:10:42 +00:00
|
|
|
n = name.lower()
|
|
|
|
if n.endswith(".atr"):
|
|
|
|
matches.append(KBootImage)
|
|
|
|
elif n.endswith(".dsk"):
|
|
|
|
matches.append(StandardDeliveryImage)
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
_, name = name.rsplit(".", 1)
|
|
|
|
except ValueError:
|
|
|
|
pass
|
2018-06-24 19:10:59 +00:00
|
|
|
raise errors.InvalidDiskImage("no disk image formats that match '%s'" % name)
|
2017-05-10 00:53:28 +00:00
|
|
|
return matches
|
|
|
|
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
mime_parsers = {
|
|
|
|
"application/vnd.atari8bit.atr": [
|
|
|
|
KBootSegmentParser,
|
|
|
|
SpartaDosSegmentParser,
|
|
|
|
AtariDosSegmentParser,
|
|
|
|
AtariBootDiskSegmentParser,
|
2017-10-02 05:28:57 +00:00
|
|
|
AtariUnidentifiedSegmentParser,
|
2016-06-01 21:54:52 +00:00
|
|
|
],
|
|
|
|
"application/vnd.atari8bit.xex": [
|
|
|
|
XexSegmentParser,
|
|
|
|
],
|
2017-03-21 06:55:36 +00:00
|
|
|
"application/vnd.atari8bit.cart": [
|
2018-10-26 02:51:33 +00:00
|
|
|
Atari8bitCartParser,
|
2017-03-21 06:55:36 +00:00
|
|
|
],
|
2018-11-08 18:12:53 +00:00
|
|
|
"application/vnd.atari5200.cart": [
|
2018-10-26 02:51:33 +00:00
|
|
|
Atari5200CartParser,
|
2017-03-21 06:55:36 +00:00
|
|
|
],
|
2018-11-08 18:27:33 +00:00
|
|
|
"application/vnd.atari2600.cart": [
|
|
|
|
Atari2600CartParser,
|
|
|
|
],
|
2018-11-08 21:38:15 +00:00
|
|
|
"application/vnd.atari2600.starpath": [
|
|
|
|
Atari2600StarpathParser,
|
|
|
|
],
|
2016-06-03 19:40:48 +00:00
|
|
|
"application/vnd.mame_rom": [
|
|
|
|
MameZipParser,
|
|
|
|
],
|
2018-10-26 02:51:33 +00:00
|
|
|
"application/vnd.rom": [
|
|
|
|
RomParser,
|
|
|
|
],
|
2016-07-20 15:13:44 +00:00
|
|
|
"application/vnd.apple2.dsk": [
|
|
|
|
Dos33SegmentParser,
|
2016-07-20 17:03:29 +00:00
|
|
|
ProdosSegmentParser,
|
2016-07-20 15:13:44 +00:00
|
|
|
],
|
2017-05-06 23:49:42 +00:00
|
|
|
"application/vnd.apple2.bin": [
|
|
|
|
Dos33BinSegmentParser,
|
|
|
|
],
|
2016-06-01 21:54:52 +00:00
|
|
|
}
|
|
|
|
|
2018-11-08 21:38:15 +00:00
|
|
|
# Note: Atari 2600 scanning not performed here because it will match everything
|
2016-06-01 21:54:52 +00:00
|
|
|
mime_parse_order = [
|
|
|
|
"application/vnd.atari8bit.atr",
|
|
|
|
"application/vnd.atari8bit.xex",
|
2017-03-21 06:55:36 +00:00
|
|
|
"application/vnd.atari8bit.cart",
|
2018-11-08 18:12:53 +00:00
|
|
|
"application/vnd.atari5200.cart",
|
2016-06-03 19:40:48 +00:00
|
|
|
"application/vnd.mame_rom",
|
2016-07-20 15:13:44 +00:00
|
|
|
"application/vnd.apple2.dsk",
|
2017-05-06 23:49:42 +00:00
|
|
|
"application/vnd.apple2.bin",
|
2018-10-26 02:51:33 +00:00
|
|
|
"application/vnd.rom",
|
2016-06-01 21:54:52 +00:00
|
|
|
]
|
|
|
|
|
2016-06-03 05:51:16 +00:00
|
|
|
pretty_mime = {
|
|
|
|
"application/vnd.atari8bit.atr": "Atari 8-bit Disk Image",
|
|
|
|
"application/vnd.atari8bit.xex": "Atari 8-bit Executable",
|
2017-03-21 06:55:36 +00:00
|
|
|
"application/vnd.atari8bit.cart": "Atari 8-bit Cartridge",
|
2018-11-08 18:12:53 +00:00
|
|
|
"application/vnd.atari5200.cart": "Atari 5200 Cartridge",
|
2018-11-08 18:27:33 +00:00
|
|
|
"application/vnd.atari2600.cart": "Atari 2600 Cartridge",
|
2018-11-08 21:38:15 +00:00
|
|
|
"application/vnd.atari2600.starpath": "Atari 2600 Starpath Cassette",
|
2016-07-20 15:13:44 +00:00
|
|
|
"application/vnd.mame_rom": "MAME",
|
2018-10-26 02:51:33 +00:00
|
|
|
"application/vnd.rom": "ROM Image",
|
2016-07-20 15:13:44 +00:00
|
|
|
"application/vnd.apple2.dsk": "Apple ][ Disk Image",
|
2017-05-06 23:49:42 +00:00
|
|
|
"application/vnd.apple2.bin": "Apple ][ Binary",
|
2016-06-03 05:51:16 +00:00
|
|
|
}
|
|
|
|
|
2016-06-02 22:09:34 +00:00
|
|
|
grouped_carts = get_known_carts()
|
|
|
|
sizes = sorted(grouped_carts.keys())
|
|
|
|
for k in sizes:
|
2016-06-03 00:18:06 +00:00
|
|
|
for c in grouped_carts[k]:
|
|
|
|
t = c[0]
|
2017-03-21 06:55:36 +00:00
|
|
|
name = c[1]
|
|
|
|
if "5200" in name:
|
2018-11-08 18:12:53 +00:00
|
|
|
key = "application/vnd.atari5200.cart"
|
|
|
|
kclass = type("Atari5200CartSegmentParser%d" % t, (Atari5200CartParser, AtariCartSegmentParser), {'cart_type': t, 'cart_info': c, 'menu_name': "%s Cartridge" % name})
|
2017-03-21 06:55:36 +00:00
|
|
|
else:
|
|
|
|
key = "application/vnd.atari8bit.cart"
|
2018-11-08 18:12:53 +00:00
|
|
|
kclass = type("Atari8bitCartSegmentParser%d" % t, (Atari8bitCartParser, AtariCartSegmentParser), {'cart_type': t, 'cart_info': c, 'menu_name': "%s Cartridge" % name})
|
2016-06-02 22:09:34 +00:00
|
|
|
mime_parsers[key].append(kclass)
|
|
|
|
|
|
|
|
|
2016-06-01 21:54:52 +00:00
|
|
|
known_segment_parsers = [DefaultSegmentParser]
|
|
|
|
for mime in mime_parse_order:
|
|
|
|
known_segment_parsers.extend(mime_parsers[mime])
|
2016-06-03 05:51:16 +00:00
|
|
|
|
2017-03-23 17:06:37 +00:00
|
|
|
|
2016-06-03 05:51:16 +00:00
|
|
|
def iter_known_segment_parsers():
|
|
|
|
yield "application/octet-stream", "", [DefaultSegmentParser]
|
|
|
|
for mime in mime_parse_order:
|
|
|
|
yield mime, pretty_mime[mime], mime_parsers[mime]
|