Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Audio
- **flac** - ``audio/x-flac``
- **wav** - ``audio/x-wav``
- **amr** - ``audio/amr``
- **aiff** - ``audio/x-aiff``

Archive
^^^^^^^
Expand Down
1 change: 1 addition & 0 deletions filetype/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
audio.Flac(),
audio.Wav(),
audio.Amr(),
audio.Aiff(),
)

# Supported font types
Expand Down
25 changes: 25 additions & 0 deletions filetype/types/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,28 @@ def __init__(self):
def match(self, buf):
return (buf[:2] == bytearray([0xff, 0xf1]) or
buf[:2] == bytearray([0xff, 0xf9]))


class Aiff(Type):
"""
Implements the AIFF audio type matcher.
"""
MIME = 'audio/x-aiff'
EXTENSION = 'aiff'

def __init__(self):
super(Aiff, self).__init__(
mime=Aiff.MIME,
extension=Aiff.EXTENSION
)

def match(self, buf):
return (len(buf) > 11 and
buf[0] == 0x46 and
buf[1] == 0x4F and
buf[2] == 0x52 and
buf[3] == 0x4D and
buf[8] == 0x41 and
buf[9] == 0x49 and
buf[10] == 0x46 and
buf[11] == 0x46)