Skip to content

Commit

Permalink
Add MP4 load(s) support [#14]
Browse files Browse the repository at this point in the history
  • Loading branch information
thebigmunch committed Mar 23, 2020
1 parent 2ad741e commit aa7c8ad
Show file tree
Hide file tree
Showing 9 changed files with 1,186 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ MP3
.. autoclass:: XingToC


MP4
---

.. autoclass:: MP4

.. autoclass:: MP4Atom
.. autoclass:: MP4Atoms
.. autoclass:: MP4StreamInfo
.. autoclass:: MP4Tags


Ogg
---

Expand Down
7 changes: 7 additions & 0 deletions src/audio_metadata/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .formats import (
FLAC,
MP3,
MP4,
WAV,
ID3v2,
MP3StreamInfo,
Expand Down Expand Up @@ -68,6 +69,12 @@ def determine_format(data):
if d.startswith(b'RIFF'):
return WAV

if (
d[4:8].lower() == b'ftyp'
and d[8:].lower().startswith((b'dash', b'm4a', b'mp4'))
):
return MP4

if d.startswith(b'ID3'):
ID3v2.parse(data)

Expand Down
2 changes: 2 additions & 0 deletions src/audio_metadata/formats/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .id3v2 import *
from .id3v2_frames import *
from .mp3 import *
from .mp4 import *
from .ogg import *
from .oggopus import *
from .oggvorbis import *
Expand All @@ -17,6 +18,7 @@
*id3v2_frames.__all__,
*id3v2.__all__,
*mp3.__all__,
*mp4.__all__,
*ogg.__all__,
*oggopus.__all__,
*oggvorbis.__all__,
Expand Down
Loading

0 comments on commit aa7c8ad

Please sign in to comment.