Commits

Anonymous committed e09bf4a

Add identifier and category to each parser: ticket:110

  • Participants
  • Parent commits 63dc8b5

Comments (0)

Files changed (53)

File hachoir-parser/hachoir_parser/archive/ar.py

     endian = BIG_ENDIAN
     MAGIC = '!<arch>\n'
     tags = {
+        "id": "unix_archive",
+        "category": "archive",
         "file_ext": ("a", "deb"),
         "mime":
             ("application/x-debian-package",

File hachoir-parser/hachoir_parser/archive/bzip2_parser.py

 
 class Bzip2Parser(Parser):
     tags = {
+        "id": "bzip2",
+        "category": "archive",
         "file_ext": ("bz2",),
         "mime": ["application/x-bzip2"],
         "min_size": 10*8,

File hachoir-parser/hachoir_parser/archive/gzip_parser.py

 class GzipParser(Parser):
     endian = LITTLE_ENDIAN
     tags = {
+        "id": "gzip",
+        "category": "archive",
         "file_ext": ("gz",),
         "mime": ["application/x-gzip"],
         "min_size": 18*8,

File hachoir-parser/hachoir_parser/archive/rpm.py

 
 class RpmFile(Parser):
     tags = {
+        "id": "rpm",
+        "category": "archive",
         "file_ext": ("rpm",),
         "mime": ["application/x-rpm"],
         "min_size": (96 + 16 + 16)*8, # file header + checksum + content header

File hachoir-parser/hachoir_parser/archive/sevenzip.py

 
 class SevenZipParser(Parser):
     tags = {
+        "id": "7zip",
+        "category": "archive",
         "file_ext": ("7z",),
         "mime": ("application/x-7z-compressed",),
         "min_size": 6*8,

File hachoir-parser/hachoir_parser/archive/tar.py

 class TarFile(Parser):
     endian = BIG_ENDIAN
     tags = {
+        "id": "tar",
+        "category": "archive",
         "file_ext": ("tar",),
         "mime": ("application/x-tar", "application/x-gtar"),
         "min_size": 512*8,

File hachoir-parser/hachoir_parser/archive/zip.py

         "application/vnd.oasis.opendocument.text-template": "ott",
     }
     tags = {
+        "id": "zip",
+        "category": "archive",
         "file_ext": list(set(MIME_TYPES.values())),
         "mime": MIME_TYPES.keys(),
 # FIXME: Re-enable magic

File hachoir-parser/hachoir_parser/audio/aiff.py

 
 class AiffFile(Parser):
     tags = {
+        "id": "aiff",
+        "category": "audio",
         "file_ext": ("aif", "aiff", ".aifc"),
         "mime": ("audio/x-aiff",),
         # FIXME: Use magic regex "FORM.{4}AIF[CF]"

File hachoir-parser/hachoir_parser/audio/au.py

 
 class AuFile(Parser):
     tags = {
+        "id": "sun_next_snd",
+        "category": "audio",
         "file_ext": ("au", "snd"),
         "mime": ("audio/basic",),
         "min_size": 24*8,

File hachoir-parser/hachoir_parser/audio/itunesdb.py

 
 class ITunesDBFile(Parser):
     tags = {
+        "id": "itunesdb",
+        "category": "audio",
         "min_size": 44*8,
         "magic": (('mhbd',0),),
         "description": "iPod iTunesDB file"

File hachoir-parser/hachoir_parser/audio/midi.py

 class MidiFile(Parser):
     MAGIC = "MThd"
     tags = {
+        "id": "midi",
+        "category": "audio",
         "file_ext": ["mid", "midi"],
         "mime": ("audio/mime", ),
         "magic": ((MAGIC, 0),),

File hachoir-parser/hachoir_parser/audio/mpeg_audio.py

 
 class MpegAudioFile(Parser):
     tags = {
+        "id": "mpeg_audio",
+        "category": "audio",
         "file_ext": ("mpa", "mp1", "mp2", "mp3"),
         "mime": ["audio/mpeg"],
         "min_size": 4*8,

File hachoir-parser/hachoir_parser/audio/real_audio.py

 class RealAudioFile(Parser):
     MAGIC = ".ra\xFD"
     tags = {
+        "id": "real_audio",
+        "category": "audio",
         "file_ext": ["ra"],
         "mime": ["audio/x-realaudio", "audio/x-pn-realaudio"],
         "min_size": 6*8,

File hachoir-parser/hachoir_parser/container/asn1.py

 
 class ASN1File(Parser):
     tags = {
+        "id": "asn1",
+        "category": "container",
         "file_ext": ("der",),
         "min_size": 16,
         "description": "Abstract Syntax Notation One (ASN.1)"

File hachoir-parser/hachoir_parser/container/mkv.py

 
 class MkvFile(Parser):
     tags = {
+        "id": "matroska",
+        "category": "container",
         "file_ext": ("mka", "mkv"),
         "mime": ("video/x-matroska", "audio/x-matroska"),
         "min_size": 5*8,

File hachoir-parser/hachoir_parser/container/ogg.py

 class OggFile(Parser):
     MAGIC = "OggS"
     tags = {
+        "id": "ogg",
+        "category": "container",
         "file_ext": ("ogg", "ogm"),
         "mime": (
             "application/ogg", "application/x-ogg",

File hachoir-parser/hachoir_parser/container/realmedia.py

 class RealMediaFile(Parser):
     MAGIC = '.RMF\0\0\0\x12\0\1'    # (magic, size=18, version=1)
     tags = {
+        "id": "real_media",
+        "category": "container",
         "file_ext": ("rm",),
         "mime": (
             "video/x-pn-realvideo",

File hachoir-parser/hachoir_parser/container/riff.py

 
 class RiffFile(Parser):
     tags = {
+        "id": "riff",
+        "category": "container",
         "file_ext": ("avi", "cda", "wav"),
         "min_size": 16*8,
         "mime": ("video/x-msvideo", "audio/x-wav", "audio/x-cda"),

File hachoir-parser/hachoir_parser/container/swf.py

 class SwfFile(Parser):
     VALID_VERSIONS = set(xrange(1, 8+1))
     tags = {
+        "id": "swf",
+        "category": "container",
         "file_ext": ["swf"],
         "mime": ["application/x-shockwave-flash"],
         "min_size": 64,

File hachoir-parser/hachoir_parser/file_system/ext2.py

        * ...
     """
     tags = {
+        "id": "ext2",
+        "category": "file_system",
         "description": "EXT2/EXT3 file system",
         "min_size": (1024*2)*8,
         "magic": (

File hachoir-parser/hachoir_parser/file_system/fat.py

 
 class FAT12(FAT_FS):
     tags = {
+        "id": "fat12",
+        "category": "file_system",
         "description": "FAT12 filesystem",
         "min_size": 512*8,
         "magic": (("FAT12   ", 54*8),),
 
 class FAT16(FAT_FS):
     tags = {
+        "id": "fat16",
+        "category": "file_system",
         "description": "FAT16 filesystem",
         "min_size": 512*8,
         "magic": (("FAT16   ", 54*8),),
 
 class FAT32(FAT_FS):
     tags = {
+        "id": "fat32",
+        "category": "file_system",
         "description": "FAT32 filesystem",
         "min_size": 512*8,
         "magic": (("FAT32   ", 54*8),),

File hachoir-parser/hachoir_parser/file_system/iso9660.py

     MAGIC = "\x01CD001"
     NULL_BYTES = 0x8000
     tags = {
+        "id": "iso9660",
+        "category": "file_system",
         "description": "ISO 9660 file system",
         "min_size": (NULL_BYTES + 6)*8,
         "magic": ((MAGIC, NULL_BYTES*8),),

File hachoir-parser/hachoir_parser/file_system/linux_swap.py

 
 class LinuxSwapFile(Parser):
     tags = {
+        "id": "linux_swap",
+        "category": "file_system",
         "min_size": PAGE_SIZE*8,
         "description": "Linux swap file",
         "magic": (

File hachoir-parser/hachoir_parser/file_system/mbr.py

     endian = LITTLE_ENDIAN
     MAGIC = "\x55\xAA"
     tags = {
+        "id": "msdos_harddrive",
+        "category": "file_system",
         "description": "MS-DOS hard drive with Master Boot Record (MBR)",
         "min_size": 512*8,
 #        "magic": ((MAGIC, 510*8),),

File hachoir-parser/hachoir_parser/file_system/ntfs.py

 class NTFS(Parser):
     MAGIC = "\xEB\x52\x90NTFS    "
     tags = {
+        "id": "ntfs",
+        "category": "file_system",
         "description": "NTFS file system",
         "min_size": 1024*8,
         "magic": ((MAGIC, 0),),

File hachoir-parser/hachoir_parser/file_system/reiser_fs.py

 
 class REISER_FS(Parser):
     tags = {
+        "id": "reiserfs",
+        "category": "file_system",
         # 130 blocks before the journal +
         # Minimal size of journal (513 blocks) +
         # 1 block for the rest

File hachoir-parser/hachoir_parser/game/laf.py

 
 class LafFile(Parser):
   tags = {
+    "id": "lucasarts_font",
+    "category": "game",
     "file_ext" : ("laf",),
     "min_size" : 8,
     "description" : "LucasArts Font"

File hachoir-parser/hachoir_parser/game/spider_man_video.py

 
 class SpiderManVideoFile(Parser):
     tags = {
+        "id": "spiderman_video",
+        "category": "game",
         "file_ext": ("bin",),
         "min_size": 8*8,
         "description": "The Amazing Spider-Man vs. The Kingpin (Sega CD) FMV video"

File hachoir-parser/hachoir_parser/game/zsnes.py

 
 class ZSNESFile(Parser):
     tags = {
+        "id": "zsnes",
+        "category": "game",
         "description": "ZSNES Save State File (only version 143)",
         "min_size": 3091*8,
         "file_ext": ("zst", "zs1", "zs2", "zs3", "zs4", "zs5", "zs6",

File hachoir-parser/hachoir_parser/image/bmp.py

 
 class BmpFile(Parser):
     tags = {
+        "id": "bmp",
+        "category": "image",
         "file_ext": ("bmp",),
         "mime": ("image/x-ms-bmp", "image/x-bmp"),
         "min_size": 30*8,

File hachoir-parser/hachoir_parser/image/gif.py

         ";": "Terminator"
     }
     tags = {
+        "id": "gif",
+        "category": "image",
         "file_ext": ("gif",),
         "mime": ["image/gif"],
         "min_size": (6 + 7 + 1 + 9)*8,   # signature + screen + separator + image

File hachoir-parser/hachoir_parser/image/ico.py

 """
-ICO picture file format parser.
+Microsoft Windows icon and cursor file format parser.
 
 Author: Victor Stinner
 """
 class IcoFile(Parser):
     endian = LITTLE_ENDIAN
     tags = {
+        "id": "ico",
+        "category": "image",
         "file_ext": ("ico",),
         "mime": ["image/x-ico"],
         "min_size": (22 + 40)*8,
             #   (nb_color=0 or 16, reserved=0, nb_plane=0 or 1,
             #    bpp in (0, 4, 8, 24, 32))
         ),
-        "description": "Microsoft icon or cursor"
+        "description": "Microsoft Windows icon or cursor",
     }
     TYPE_NAME = {
         1: "icon",

File hachoir-parser/hachoir_parser/image/jpeg.py

 class JpegFile(Parser):
     endian = BIG_ENDIAN
     tags = {
+        "id": "jpeg",
+        "category": "image",
         "file_ext": ("jpg", "jpeg"),
         "mime": ["image/jpeg"],
         "magic": (

File hachoir-parser/hachoir_parser/image/pcx.py

 class PcxFile(Parser):
     endian = LITTLE_ENDIAN
     tags = {
+        "id": "pcx",
+        "category": "image",
         "file_ext": ("pcx",),
         "mime": ["image/x-pcx"],
         "min_size": 128*8,

File hachoir-parser/hachoir_parser/image/png.py

 
 class PngFile(Parser):
     tags = {
+        "id": "png",
+        "category": "image",
         "file_ext": ("png",),
         "mime": ("image/png", "image/x-png"),
         "min_size": 8*8, # just the identifier

File hachoir-parser/hachoir_parser/image/psd.py

 class PsdFile(Parser):
     endian = BIG_ENDIAN
     tags = {
+        "id": "psd",
+        "category": "image",
         "file_ext": ("psd",),
         "mime": ("image/psd", "image/photoshop", "image/x-photoshop"),
         "min_size": 4*8,

File hachoir-parser/hachoir_parser/image/tga.py

 
 class TargaFile(Parser):
     tags = {
+        "id": "targa",
+        "category": "image",
         "file_ext": ("tga",),
         "mime": ("image/targa", "image/tga", "image/x-tga"),
         "min_size": 18*8,

File hachoir-parser/hachoir_parser/image/tiff.py

 
 class TiffFile(Parser):
     tags = {
+        "id": "tiff",
+        "category": "image",
         "file_ext": ("tif", "tiff"),
         "mime": ("image/tiff",),
         "min_size": 8*8,

File hachoir-parser/hachoir_parser/image/wmf.py

 
 class WMF_File(Parser):
     tags = {
+        "id": "wmf",
+        "category": "image",
         "file_ext": ("wmf", "apm", "emf"),
         "mime": (
             "image/wmf", "image/x-wmf", "image/x-win-metafile",

File hachoir-parser/hachoir_parser/image/xcf.py

 
 class XcfFile(Parser):
     tags = {
+        "id": "xcf",
+        "category": "image",
         "file_ext": ("xcf",),
         "mime": ("image/x-xcf", "application/x-gimp-image"),
         "min_size": (26 + 8 + 4 + 4)*8, # header+empty property+layer offset+channel offset

File hachoir-parser/hachoir_parser/misc/file_3do.py

 
 class File3do(Parser):
     tags = {
+        "id": "3do",
+        "category": "misc",
         "file_ext": ("3do",),
         "mime": ("image/x-3do",),
         "min_size": 8,

File hachoir-parser/hachoir_parser/misc/file_3ds.py

 class File3ds(Parser):
     endian = LITTLE_ENDIAN
     tags = {
+        "id": "3ds",
+        "category": "misc",
         "file_ext": ("3ds",),
         "mime": ["image/x-3ds"],
         "min_size": 16*8,

File hachoir-parser/hachoir_parser/network/tcpdump.py

 
 class TcpdumpFile(Parser):
     tags = {
+        "id": "tcpdump",
+        "category": "misc",
         "min_size": 8,
         "description": "Tcpdump file (network)",
         "magic": (("\xd4\xc3\xb2\xa1", 0),),

File hachoir-parser/hachoir_parser/office/msoffice.py

     BIG_BLOCK_SIZE = 512
 
     tags = {
+        "id": "ole2",
+        "category": "misc",
         "file_ext": (
             "doc", "dot",                # Microsoft Word
             "ppt", "ppz", "pps", "pot",  # Microsoft Powerpoint

File hachoir-parser/hachoir_parser/program/elf.py

 
 class ElfFile(Parser):
     tags = {
+        "id": "elf",
+        "category": "program",
         "file_ext": ("so",), # What about "no extension"?
         "min_size": (4+32)*8,  # At least one program header
         "mime": (

File hachoir-parser/hachoir_parser/program/exe.py

 
 class ExeFile(Parser):
     tags = {
+        "id": "exe",
+        "category": "program",
         "file_ext": ("exe",),
         "mime": ("application/x-dosexec",),
         "min_size": 64*8,

File hachoir-parser/hachoir_parser/program/java.py

     endian = BIG_ENDIAN
 
     tags = {
+        "id": "java_class",
+        "category": "program",
         "file_ext": ("class",),
         "mime": ("application/java-vm",),
         "min_size": (32 + 3*16),

File hachoir-parser/hachoir_parser/program/python.py

 
 class PythonCompiledFile(Parser):
     tags = {
+        "id": "python",
+        "category": "program",
         "file_ext": ("pyc", "pyo"),
         "min_size": 9*8,
         "description": "Compiled Python script (.pyc/.pyo files)"

File hachoir-parser/hachoir_parser/video/asf.py

 class AsfFile(Parser):
     MAGIC = "\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C"
     tags = {
+        "id": "asf",
+        "category": "video",
         "file_ext": ("wmv", "wma", "asf"),
         "mime": ("video/x-ms-asf", "video/x-ms-wmv", "audio/x-ms-wma"),
         "min_size": 24*8,

File hachoir-parser/hachoir_parser/video/flv.py

 
 class FlvFile(Parser):
     tags = {
+        "id": "flv",
+        "category": "video",
         "file_ext": ["flv"],
         "mime": ["video/x-flv"],
         "min_size": 9*4,

File hachoir-parser/hachoir_parser/video/mov.py

 
 class MovFile(Parser):
     tags = {
+        "id": "mov",
+        "category": "video",
         "file_ext": ("mov", "qt", "mp4", "m4v", "m4a", "m4p", "m4b"),
         "mime": ["video/quicktime"],
         "min_size": 8*8,

File hachoir-parser/hachoir_parser/video/mpeg_ts.py

             self._size = 188*8
 
     PID = {
-        0x44: "video",
-        0x45: "audio",
+        0x0000: "Program Association Table (PAT)",
+        0x0001: "Conditional Access Table (CAT)",
+        # 0x0002..0x000f: reserved
+
+        # TODO: Check above values
+        0x0044: "video",
+        0x0045: "audio",
     }
 
     def createFields(self):
         yield Bit(self, "priority")
         yield Enum(Bits(self, "pid", 13, text_handler=hexadecimal), self.PID)
         yield Bits(self, "scrambling_control", 2)
-
         yield Bit(self, "has_adaptation")
         yield Bit(self, "has_payload")
-
         yield Bits(self, "counter", 4)
         yield RawBytes(self, "payload", 184)
         if self["has_error"].value:
 
 class MPEG_TS(Parser):
     tags = {
+        "id": "mpeg_ts",
+        "category": "video",
         "file_ext": ("ts",),
         "min_size": 188*8,
         "description": u"MPEG-2 Transport Stream"

File hachoir-parser/hachoir_parser/video/mpeg_video.py

 
 class MPEGVideoFile(Parser):
     tags = {
+        "id": "mpeg_video",
+        "category": "video",
         "file_ext": ("mpeg", "mpg", "mpe", "vob"),
         "mime": ("video/mpeg", "video/mp2p"),
         "min_size": 12*8,