Travis Shirk  committed 19fbaf5

Recognize more mp3 file mime types. Fixes issue #39.

  • Participants
  • Parent commits c0ebef1
  • Branches stable

Comments (0)

Files changed (2)

File src/eyed3/

     eventual format of the metadata.
     from . import mp3, id3
-"Loading file: %s" % path)
+    log.debug("Loading file: %s" % path)
     if os.path.exists(path):
         if not os.path.isfile(path):
         raise IOError("file not found: %s" % path)
     mtype = guessMimetype(path)
-    if mtype in mp3.MIME_TYPES:
+    log.debug("File mime-type: %s" % mtype)
+    if (mtype in mp3.MIME_TYPES or
+        (mtype in mp3.OTHER_MIME_TYPES and
+         os.path.splitext(path)[1].lower() in mp3.EXTENSIONS)):
         return mp3.Mp3AudioFile(path, tag_version)
     elif mtype == "application/x-id3":
         return id3.TagFile(path, tag_version)
 def parseError(ex):
+    '''A function that is invoked when non-fatal parse, format, etc. errors
+    occur. In most cases the invalid values will be ignored or possibly fixed.
+    This function simply logs the error.'''

File src/eyed3/mp3/

 NAME = "mpeg"
 MIME_TYPES = ["audio/mpeg", "audio/mp3", "audio/x-mp3", "audio/x-mpeg",
               "audio/mpeg3", "audio/x-mpeg3", "audio/mpg", "audio/x-mpg",
-              "audio/x-mpegaudio"]
+              "audio/x-mpegaudio",
+             ]
 '''Mime-types that are recognized at MP3'''
+OTHER_MIME_TYPES = ['application/octet-stream', # ???
+                    'audio/x-hx-aac-adts', # ???
+                    'audio/x-wav',  #RIFF wrapped mp3s
+                   ]
+'''Mime-types that have been seen to contain mp3 data.'''
+EXTENSIONS = [".mp3"]
+'''Valid file extensions.'''
 def isMp3File(file_name):
     '''Does a mime-type check on ``file_name`` and returns ``True`` it the
     file is mp3, and ``False`` otherwise.'''